I have a query that selects data from a table based on some inner joins:
select * from table1 p
inner join table2 e on e.col1='YU' and e.username=p.username
inner join table3 d on p.col2=d.col3 and d.col4="IO" and d.col5=-1 and e.col3=d.col6
The output of this contains the rows from table1 that I want to delete. So I tried this:
delete from table1 p
inner join table2 e on e.col1='YU' and e.username=p.username
inner join table3 d on p.col2=d.col3 and d.col4="IO" and d.col5=-1 and e.col3=d.col6
But that is not a valid query and returns an error. How can I delete all the rows from table1 which are the result of the above SELECT statement?