[Date Prev][Date
Next][Thread Prev][Thread Next][Date
Index][Thread Index]
Re: [OT] SQL question
Mark Hetherington wrote:
>
>This should do it:
>
>SELECT DISTINCT ON (Parent) Parent,Date,Comment FROM child ORDER BY
Date
>DESC
>
>It will basically sort all rows by date then select only the first row
(i.e.
>the most recent entry). DESC is to ensure that we get the latest date
at the
>top of the resulting table since SQL defaults to ASC.
>
Mark - what database is SELECT DISTINCT ON in ? SQL Server doesn't like
it, and SQL Server Books Online says the options are ALLDISTINCT ...... :(
Doogie
Home |
Main Index |
Thread Index
|