The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024

Latest message you have seen: RE: CAT5 vs. Wire ---- LESS ----


[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

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.