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

delete with inner join????

Status
Not open for further replies.

mgould00

Programmer
Feb 18, 2003
22
0
0
US
i am having trouble with the following statement:

delete from product inner join company_supplies on product.id = company_supplies.product_id where company_id = 1

it says i have an error near 'inner join'. can you not use inner join with delete in mysql? the select statement i use with the same syntax works fine...
thanks....
 
Try use a transaction; send us the table scripts and more info about what you are trying to do.

Bye


Qatqat

The reason why my girlfriend can read my thoughts is because mine are properly written! (G.Lepore)
 
well, to be more specific.....
i am not trying to delete from more than one table, but trying to delete several items from the products table by referencing a field in the customer_supplies table.

so i have the customer_id (in my example it is set to 1) i gather all the product_id in the customer_supplies table (could be 4,16,90,18,etc) where customer_id=1. then find all those product_id's in the products table and delete them.

hope that explains it better....
thanks
 
If you have a version < 4 this means that you have to first do the select from the customer_supplier table, and then use the result to build a delete statement with explicit values.
 
hmmmm....
i have version 3.23 or something like that. i guess i will take your advice swampboogie.
thanks fellas....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top