How to select 5 lines, 1 for each site_id, this causes an error
SELECT DISTINCT site_id, *
FROM deal
WHERE site_id IN (2, 3, 4, 5, 6)
ORDER BY id
DESC LIMIT 5
You have an error in the SQL syntax; check the manual that matches your MySQL server version for the correct syntax to use next to * * FROM deal WHERE site_id IN (2, 3, 4, 5, 6) ORDER BY id DESC LIMIT 5 'on line 1 "
source
share