Re: SQL TRICK. Select rowid, max(...)
Posted in 1994
In article <2m1stp$am@bilbo.nask.org.pl> doctorq@sam (DoctorQ Komputery i Programy) writes:
>We've discussed problem with max() function with friends and we think that
>SQL syntax should be extended:
>There should be 'IS MAX' clause in WHERE section, similarly to 'IS NULL'
>clause.
>
>For example:
>select rowid from table where col is max>
>Why?
>Today, MAX() is treated like SUM() or COUNT(). But there is a big difference
>between them: SUM() and COUNT() are features of whole column of table.
>MAX() is feature of column, but it's also a feature of a row!
>You can pick rows with max (or min of course) value. Of course it's
>nonsense with SUM() or COUNT().
>That's the difference.
>
>What do you think about it, Informix people?
>
I think the current implementation is correct.
MAX() is not a feature of a single row.
Multiple rows may match MAX(col).
-----------------------------------------------------------------
Jim Burks jburks@promus.com
The Promus Companies
Memphis, Tennessee, USA