Posted by Erland Sommarskog on 10/10/36 11:33
Yannick Turgeon (vendredi5h@gmail.com) writes:
> Ok. Thanks to both of you.
>
> I think something like:
>
> SELECT a.data
> FROM #Test a
> WHERE a.type = 'A'
> GROUP BY a.type
> HAVING pid = MAX(pid)
>
> or even better:
>
> SELECT a.data
> FROM #Test a
> WHERE a.type = 'A'
> AND pid = MAX(pid)
>
> would be a good functionnality (with MAX or any other aggregate
> function) to add to transact/SQL or to SQL standard.
Maybe. If it clear what it means. Which in at least in the second
case is not at all clear. MAX(pid) in the entire #Test? MAX(pid) for
type = 'A' or what?
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|