I have this database table:
post_id | key | value
297 | title | test
297 | price | 50
250 | title | test2
250 | price | 75
100 | title | test3
100 | price | 100
The question is: how can I get all (grouped) post_ids with a where on price and ordered by title.
This is not working:
SELECT post_id
, price*1 AS number
FROM table
WHERE number <= 75
ORDER
BY key
GROUP
BY post_id;
2
Answers
Assuming that there is strictly one price and title per post: