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)
 help with a simple(ish) Select Query

Author  Topic 

ricc
Starting Member

16 Posts

Posted - 2007-02-19 : 08:44:54
Hi

I Have the following table

SequenceNumber___TypeID
8_________________IMG
7_________________IMG
6_________________IMG
5_________________IMG
4_________________IMG
3_________________IMG
2_________________FLP
2_________________IMG


I want to pull the data out in the following format,

SequenceNumber___TypeID
8_________________IMG
2_________________FLP


This basically shows the highest SequenceNumber of each TypeID,

I've tried many different SQL queries but I can't seem to get it! Any ideas?

Thanks

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-02-19 : 08:53:04
Can you show us what you have tried so far? This is simple case of GROUP BY.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-19 : 09:21:08
And a MAX aggregation.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -