Hi!
I've got those collumns in PG database to work with - photoid, filename, challid, rating.
What's the query to get unique(distinct) challid and results ordered by rating? Can't figure it out. I need to fetch all given collumns as well.
Thanks for any hints
Cheers
Tom
distinct and order by trouble
Moderator: General Moderators
Tried loads but didn't find how to do it.Pimptastic wrote:what sql have you got at the moment?
Atm I it works for me with SELECTing DISTINCT challid, insterting them to array and then doing foreach for that array and SELECTING particular photoid ORDERED BY rating LIMIT 1. That first query is LIMIT 16 so it's not so bad but I'm sure that I should be able to do that with one query
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany