group by with value of another column
Posted
by phenevo
on Stack Overflow
See other posts from Stack Overflow
or by phenevo
Published on 2010-04-29T13:46:04Z
Indexed on
2010/04/29
13:47 UTC
Read the original article
Hit count: 180
sql-server-2005
Hi,
I've got table Articles
ID identity autoincement, IDArticle: nvarchar(100) ,IDCar nvarchar(100), createddate
How to convert this:
SELECT IDCar , MAX(createddate)
FROM Articles
GROUP BY IDCar
to get IDArticle eg:
1 art1 BWM 5-21-2010
2 art2 BMW 5-24-2010
3 art3 BMW 5-31-2010
4 art4 Porshe 5-31-2010
5 art5 Porshe 6-1-2010
Expecting result is:
art3
art5
It's not duplicated with: http://stackoverflow.com/questions/2736769/sql-query-number-of-occurance/2736809#2736809
© Stack Overflow or respective owner