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 |
|
bhaasjoshi
Starting Member
17 Posts |
Posted - 2009-08-18 : 06:07:39
|
| DataCol1 Col2AA xA BBBB yI need an output containing the first 2 rows for 'A' since col2 of 2nd row is not blank, and the 3rd and 4th rows for 'B' since the 4th row is not blank.So basically I need to flag those records which are not blank in combination with preceding record which are blank.Please help.Regards. |
|
|
Mangal Pardeshi
Posting Yak Master
110 Posts |
Posted - 2009-08-18 : 06:15:52
|
| is there any key or id column available in the table?Mangal Pardeshihttp://mangalpardeshi.blogspot.com |
 |
|
|
bhaasjoshi
Starting Member
17 Posts |
Posted - 2009-08-18 : 06:17:19
|
| No Sir. No ID/Key. I tried using LEAD or LAG Function but couldn't get it to work properly.Thanks. |
 |
|
|
Mangal Pardeshi
Posting Yak Master
110 Posts |
Posted - 2009-08-18 : 06:29:48
|
| any date column? otherwise how to identify which are the consecuative rows?Mangal Pardeshihttp://mangalpardeshi.blogspot.com |
 |
|
|
bhaasjoshi
Starting Member
17 Posts |
Posted - 2009-08-18 : 06:36:48
|
| Well, there are other columns dates etc but the data is already sorted etc, Its just that my final output will only consist of the records I mentioned. |
 |
|
|
|
|
|