* Adrian Ho <[EMAIL PROTECTED]> [2006-05-23 16:05]: > On Tue, May 23, 2006 at 08:50:56AM +0200, A. Pagaltzis wrote: > > * [EMAIL PROTECTED] <[EMAIL PROTECTED]> [2006-05-23 02:35]: > > > What you have to do is: > > > > > > SELECT qi, ri, drl, score > > > FROM ... > > > WHERE score=(SELECT max(score) FROM ...) > > > > Actually, in cases such as this, the easiest approach is to > > use `LIMIT`: > > > > SELECT qi, ri, drl, score > > FROM ... > > WHERE ... > > ORDER BY score DESC > > LIMIT 1 > > Only if "cases such as this" is defined as "datasets where only > one record has the maximum score" (which may be the case that > Brannon presented -- I don't recall offhand). Otherwise, the > two queries above are semantically different and should > reasonably be expected to return different results.
I actually thought of that. However, note that the *original* query to which Mr. Hipp is referring actually used an aggregate function in the `SELECT` clause and would thus always return only exactly one row. So my reformulation is arguably the correct way to express Brannon’s original intent. Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>