in reply to MAX and GROUP BY in DBIx::Class
As brother ysth has said, this is database dependent. Generally, you'd order your result set by score DESC; then, in SQL Server, you'd ask for TOP 1 after the select keyword; in Oracle, you'd use ROWNUM <= 1 in the WHERE clause (I think); in MySQL you'd use LIMIT 1 at the end of the query; I can't remember what you'd do in PostgreSQL, maybe LIMIT 1 as well?
The ugly way to do it would be to get the whole array, then just take the first row, but that goes against the ethos of getting the database to do as much work as possible.
|
|---|