Delete Data

Last Post 17 Jun 2009 04:33 AM by dale123. 1 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
JASBRYDEN
New Member
New Member

--
16 Jun 2009 06:48 PM
Hi

I would like to know how to delete data in step 2.

My first Step would delete the data from the detail table, I have to delete the data from the detail table first other wise I would get an error, then I want to delete the data in the header that is not in the detail.

My select statement works great, but I want to delete that data in which the select statement is showing...how to do this ???


Step 1
use data1
delete from dbo.BTStandardLoadDetail
where tempqty='0.00'


Step 2
select * from BTStandardLoadHeader as h
where not exists (select * from BTStandardLoadDetail as d where
h.standardno=d.standardno)
dale123
New Member
New Member

--
17 Jun 2009 04:33 AM
try

delete from BTSStandardLoadHeader
where <Id Column> in
(select <Id Column> from BTStandardLoadHeader as h
where not exists (select * from BTStandardLoadDetail as d where
h.standardno=d.standardno))

i don't have the colunms / tables etc so i can't really try it.
You are not authorized to post a reply.

Acceptable Use Policy