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 |
|
ranganath
Posting Yak Master
209 Posts |
Posted - 2007-06-13 : 00:57:21
|
| Declare @Temp Table ( Pid int, timeperiod varchar(100), pname varchar(100))Insert into @TempSelect 10,'7.00AM','AAA'union allSelect 10,'7.10AM','BBB'union allSelect 20,'7.20AM','CCC'union allSelect 20,'7.30AM','DDD'union allSelect 10,'7.40AM','EEE'union allSelect 30,'7.50AM','FFF'union allSelect 30,'8.00AM','GGG'union allSelect 20,'8.10AM','HHH'union allSelect 30 ,'8.20AM','III' union allSelect 10,'8.30AM','JJJ'union allSelect 20,'8.40AM','KKK'Select * From @Temp MY DESIRE OUTPUT ISPID PDATE PNAME20 7.20AM CCC 20 7.30AM DDD10 7.40AM EEE 30 7.50AM FFF30 8.00AM GGG20 8.10AM HHH30 8.20AM III10 8.30AM JJJ20 8.40AM KKK |
|
|
ranganath
Posting Yak Master
209 Posts |
Posted - 2007-06-13 : 00:59:52
|
| dont think top 2 records |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-06-13 : 01:03:49
|
quote: Originally posted by ranganath dont think top 2 records
when what should i think ? What is the logic here ? KH |
 |
|
|
ranganath
Posting Yak Master
209 Posts |
Posted - 2007-06-13 : 01:20:41
|
| I want to delete pid =10 then delete first 2 records shows remaining records including 10 not first 2 recordssimilarly pid = 20 and 30 |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-06-13 : 02:33:17
|
quote: Originally posted by ranganath I want to delete pid =10 then delete first 2 records shows remaining records including 10 not first 2 recordssimilarly pid = 20 and 30
when you delete pid = 10, why the 7:40 CCC record is not deleted ? KH |
 |
|
|
|
|
|
|
|