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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subquery in delete statement

Status
Not open for further replies.

anithamg

Programmer
Nov 21, 2002
6
0
0
US
delete tbltravel as tt1 where tt1.travelerid, tt1.recordlocator in
(SELECT tblTravel.TravelerID, tblTravel.RecordLocator,max(TravelDate)
FROM tblTravel
group by travelerid,recordlocator
having max(traveldate) < date()-30)

This doesn't work def.. I need a solution where u can condition on 2 fields for delete statement with the result from a subquery.
 
Delete Tbl1.*
From tbl1 t
Where t.Field1 in (Select field From Tbl2....) and
t.field2 in (select field From tbl3....)

If I have understood correctly the above will give you a patern to work from. It is important that the IN (SELECT..)returns only one field to compare to.

ssecca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top