Hi,
I currently have a table called “pages” containing the following columns:
pageid, domainid, location, lastread
I've put together a query that returns 10 rows with the lowest “lastread” values, for which this works fine:
SELECT * FROM pages ORDER BY lastread ACS LIMIT 10;
I now the have the added complication that I want to make sure each value in “domainid” is unique. That is to say, not repeated within the 10 results returned. I though I might be able to do something using “GROUP BY domainid” but that cannot just work on the one column as far as I can see.
Also the “DISTINCT” keyword only ensures the entire row is unique.
If anyone can offer me some advice on how I could go about this or if its ever possible from one SQL statement I would be most grateful.
Thanks
Neil
I currently have a table called “pages” containing the following columns:
pageid, domainid, location, lastread
I've put together a query that returns 10 rows with the lowest “lastread” values, for which this works fine:
SELECT * FROM pages ORDER BY lastread ACS LIMIT 10;
I now the have the added complication that I want to make sure each value in “domainid” is unique. That is to say, not repeated within the 10 results returned. I though I might be able to do something using “GROUP BY domainid” but that cannot just work on the one column as far as I can see.
Also the “DISTINCT” keyword only ensures the entire row is unique.
If anyone can offer me some advice on how I could go about this or if its ever possible from one SQL statement I would be most grateful.
Thanks
Neil