title: how to set every rows primary key for sub Query
body: <p>I am new in mysql. please help</p>
  <p>I want to user current row post id to   use in sub query for count.
  What should I use in the place of  &quot;current_row_post_id&quot; in the query</p>
  <p><code>SELECT post_id, title, description, (SELECT COUNT(*) FROM posts_reacts WHERE react_type_id = 1 AND posts.post_id = ? current_row_post_id ) AS total_love, (SELECT COUNT(*) FROM posts_reacts WHERE react_type_id = 2 AND posts.post_id = ? current_row_post_id) AS total_tanks FROM posts; </code></p>
  <p>posts table description:</p>
  <pre><code>+--------------+---------------+----+---+-----------------+---------------------------------------------+
  |Field         |Type           |Null|Key|Default          |Extra                                        |
  +--------------+---------------+----+---+-----------------+---------------------------------------------+
  |post_id       |bigint unsigned|NO  |PRI|NULL             |auto_increment                               |
  |post_type     |varchar(20)    |NO  |   |NULL             |                                             |
  |title         |varchar(256)   |YES |   |NULL             |                                             |
  |description   |text           |YES |   |NULL             |                                             |
  |group_id      |bigint unsigned|YES |   |NULL             |                                             |
  |shared_post_id|bigint unsigned|YES |   |NULL             |                                             |
  |user_id       |bigint unsigned|NO  |   |NULL             |                                             |
  |created_at    |timestamp      |NO  |   |CURRENT_TIMESTAMP|DEFAULT_GENERATED                            |
  |updated_at    |timestamp      |NO  |   |CURRENT_TIMESTAMP|DEFAULT_GENERATED on update CURRENT_TIMESTAMP|
  +--------------+---------------+----+---+-----------------+---------------------------------------------+
  
  </code></pre>
  <p>posts_reacts table description:</p>
  <pre><code>+-------------+---------------+----+---+-----------------+---------------------------------------------+
  |Field        |Type           |Null|Key|Default          |Extra                                        |
  +-------------+---------------+----+---+-----------------+---------------------------------------------+
  |post_react_id|bigint unsigned|NO  |PRI|NULL             |auto_increment                               |
  |post_id      |bigint unsigned|NO  |MUL|NULL             |                                             |
  |user_id      |bigint unsigned|NO  |   |NULL             |                                             |
  |react_type_id|int            |NO  |   |NULL             |                                             |
  |created_at   |timestamp      |NO  |   |CURRENT_TIMESTAMP|DEFAULT_GENERATED                            |
  |updated_at   |timestamp      |NO  |   |CURRENT_TIMESTAMP|DEFAULT_GENERATED on update CURRENT_TIMESTAMP|
  +-------------+---------------+----+---+-----------------+---------------------------------------------+
  
  
  </code></pre>