I have a table ITEMS, which has the props id, site_id, frequency
So far i can list the items and order them by frequency from an array of id, using
SELECT *
FROM items
WHERE id IN(1549, 1550, 1635, 1637)
ORDER BY site_id, frequency DESC
But i’d like to group my results by site_id with only one item that has the best (highest) frequency..
how do i do ?
Edit : I’d like to have the items that have the best frequency grouped by site_id (one result by site_id)
Note: This will give you more than one row per
site_idif both have the same frequency.