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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-01-25 : 08:16:33
|
| seetaramaiah writes "i want to display a row from the table based on some condition,how many rows continuously satisfy the condition and with in this continuously satisfy records get the starting record means like RptDate Status2005-12-01 N2005-12-02 Y2005-12-03 Y2005-12-04 N2005-12-05 Y2005-12-06 N2005-12-07 Y2005-12-08 Y2005-12-09 Yi want to get the result like RptDate=2005-12-07 and Continuosly satisfy the latest dates status='y' is 3" |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-01-25 : 09:02:57
|
| You mean you wanty to find the sequence of rows later than 2005-12-07 which are all 'y'?select *from tbl twhere RptDate > '20051207'and not exists (select * from tbl t2 where t2.RptDate <= t.RptDate and t2.RptDate > '20051207' and t2.Status <> 'y')==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|