Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delete query 1

Status
Not open for further replies.

swoodring

Programmer
Dec 7, 2000
114
US
I am trying to do an inner join and based on the join delete the records. Here's the query I'm using. Basically I want to delete all detail records that are found in the header where the transactiontype is '00' What am I doing wrong. It gives me the following syntex error - incorrect syntex near d. This query works fine as just a select statment.

delete salesdetailretail d
join salesheaderretail h
on h.storenumber = d.storenumber and
h.controller = d.controller and
h.register# = d.registernum and
h.transaction# = d.transactionnum and
h.transactiondate = d.transactiondate

where transactiontype = '00'
order by d.transactiondate, d.transactionnum, d.sequencenum


 
Does this work

delete d
from salesdetailretail d
join salesheaderretail h
on h.storenumber = d.storenumber and
h.controller = d.controller and
h.register# = d.registernum and
h.transaction# = d.transactionnum and
h.transactiondate = d.transactiondate
where transactiontype = '00'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top