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)
 need help in query

Author  Topic 

ajmaly
Starting Member

11 Posts

Posted - 2010-07-26 : 12:05:39
Below is the main tble
Original table,


key Name Order
1 A1 1
1 A2 2
1 A3 3
2 B1 1
2 B2 2
2 B3 3


Need to select records for order #1 and order #2 from each set, i.e, Output table shold be,

key Name Order
1 A1 1
1 A2 2
2 B1 1
2 B2 2

Please help me writing query?




ajmal

X002548
Not Just a Number

15586 Posts

Posted - 2010-07-26 : 12:15:07
SELECT * FROM table WHERE [Order] IN (1,2) ORDER BY [key]

????

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -