Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Grouping Select Query

Author  Topic 

airdos
Starting Member

1 Post

Posted - 2010-09-03 : 14:47:46
Hello,

Here is what I need to do but I am running into a problem.

Table

ID SUBID YEAR DESC
1 1 2010 Test1
2 1 2008 Test2
3 2 2010 Test3
4 2 2008 Test4

I would like to select the max(SubID) and max(Year) at the same time but carry over the Desc and ID. The tables I am working with are a lot larger and have many more columns (joined) I need to carry through to the result.

Results:

ID SUBID YEAR DESC
1 1 2010 Test1
3 2 2010 Test3

Any help would be appreciated.

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2010-09-03 : 20:14:22
try with a co-related sub query.. post what you have and we can help...

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page
   

- Advertisement -