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 2000 Forums
 SQL Server Development (2000)
 Delete

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 @Temp
Select 10,'7.00AM','AAA'union all
Select 10,'7.10AM','BBB'union all
Select 20,'7.20AM','CCC'union all
Select 20,'7.30AM','DDD'union all
Select 10,'7.40AM','EEE'union all
Select 30,'7.50AM','FFF'union all
Select 30,'8.00AM','GGG'union all
Select 20,'8.10AM','HHH'union all
Select 30 ,'8.20AM','III' union all
Select 10,'8.30AM','JJJ'union all
Select 20,'8.40AM','KKK'
Select * From @Temp



MY DESIRE OUTPUT IS

PID PDATE PNAME

20 7.20AM CCC
20 7.30AM DDD
10 7.40AM EEE
30 7.50AM FFF
30 8.00AM GGG
20 8.10AM HHH
30 8.20AM III
10 8.30AM JJJ
20 8.40AM KKK

ranganath
Posting Yak Master

209 Posts

Posted - 2007-06-13 : 00:59:52
dont think top 2 records
Go to Top of Page

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

Go to Top of Page

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 records
similarly pid = 20 and 30
Go to Top of Page

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 records
similarly pid = 20 and 30


when you delete pid = 10, why the 7:40 CCC record is not deleted ?


KH

Go to Top of Page
   

- Advertisement -