What am i trying to do
I try to get commentIdby asking type = xandtarget = x ,
usually (THIS EXAMPLE) , the table structure should look like this:
+-----------+-------+--------+
| commentId | type | target |
+-----------+-------+--------+
| 1 | post | 2 |
| 2 | post | 8 |
| 3 | video | 6 |
+-----------+-------+--------+
and in this situation, I can use this query to get commentId:
SELECT `commentId` FROM `comment_datas` WHERE type = 'post' AND target = '2'
Real problem
But this is the real table structure (with key value construction):
+-----------+--------+-------+
| commentId | name | value |
+-----------+--------+-------+
| 1 | type | post |
| 1 | target | 2 |
| 2 | type | post |
| 2 | target | 8 |
| 3 | type | post |
| 3 | target | 6 |
+-----------+--------+-------+
Now I donβt know how to get commentIdany thoughts on the request I wrote above.
source
share