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.
| Author |
Topic |
|
korssane
Posting Yak Master
104 Posts |
Posted - 2010-06-23 : 11:54:24
|
| hi guys , i am stuck with a query here..i have a table with 5 columns ( col1,col2,..col5)what i need is to pull all columns info where Col3 has a specific value " vallue3" and col1 values are upper than or equal the col1 value associated with "value3"here is my code :select T1.col1,T1.col2,T1.col3,FORM table1 T1cross apply (Top (1) T2.col2,T2.col3FROM table1 T2 where (T2.col3 ='value3')) T2WHERE (T1.col2 >= T2.col2)order by T1.col2, asc;any help will be appreciated.!!thanksthanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-06-23 : 12:47:58
|
| may be thisselect T1.col1,T1.col2,T1.col3,T2.col2,T2.col3FORM table1 T1cross apply (Top (1) col2,col3FROM table1 where col3 ='value3'and T1.col2 >= col2order by col2 asc) T2------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
korssane
Posting Yak Master
104 Posts |
Posted - 2010-06-23 : 14:47:06
|
| thanks Visakh16..trying it and getting only the 1 st record correct .. |
 |
|
|
|
|
|