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)
 SQL statement help

Author  Topic 

hzx
Starting Member

3 Posts

Posted - 2007-08-27 : 16:09:48
I have a table data format like

ID field1
1 4
2 3
3 3
4 3
5 7
6 8
7 11
8 11
I am trying make a statement to retrieve records with ID 1, 4, 5, 6, 8
i.e. for the same value in field1 should only retrieve record with biggest ID. Thank you in advance.

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2007-08-27 : 16:13:06
is this homework?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-27 : 16:17:29
Read about GROUP BY and MAX statements in Books Online, your future best friend.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

hzx
Starting Member

3 Posts

Posted - 2007-08-27 : 16:24:38
quote:
Originally posted by eyechart

is this homework?

This my real work, I am trying almost whole day, no luck at all.
Go to Top of Page

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2007-08-27 : 17:05:25
quote:
Originally posted by hzx

quote:
Originally posted by eyechart

is this homework?

This my real work, I am trying almost whole day, no luck at all.



please paste the SQL query you are trying and we can help you correct it.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-27 : 17:13:08
You're bad, eyechart, bad



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-08-28 : 03:03:24
Also Learn SQL

http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -