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

Delete Statement 1

Status
Not open for further replies.

saw15

Technical User
Jan 24, 2001
468
US
I need to delete the contents of the following select statement.. but get a syntax error.

Modified a few things, but still having issues. Wondering what the correct way to write this:

select * from employer_plan
left join stage_employer_plan on employer_plan.sub_group_id = stage_employer_plan.plan_rider_code
where stage_employer_plan.plan_rider_code is null
and employer_plan.employer_plan_key not in (select employer_plan_key from member_history)
 
You can only delete from one table at a time. To delete from the employer_plan table try this:

Code:
DELETE employer_plan
FROM employer_plan left join stage_employer_plan on employer_plan.sub_group_id = stage_employer_plan.plan_rider_code
where stage_employer_plan.plan_rider_code is null
and employer_plan.employer_plan_key not in (select employer_plan_key from member_history)
--James
 
Thanks ... just what I needed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top