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.

Alex / talexb / Toronto

As of June 2025, Groklaw is back! This site was a really valuable resource in the now ancient fight between SCO and Linux. As it turned out, SCO was all hat and no cattle.Thanks to PJ for all her work, we owe her so much. RIP -- 2003 to 2013.