Jump to content


Photo

deleteing linked rows from multiple tables


  • Please log in to reply
1 reply to this topic

#1 missyevil

missyevil
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 26 April 2006 - 11:43 AM

Hi!

Basically I want to delete entries from 3 tables - table1, table2 and linktable.

I have something along the lines of:

DELETE FROM table1, table2, linktable 
WHERE linktable.id1=table1.id AND linktable.id2=table2.id

BUT, I'm getting syntax errors returned.

I'm very new to MySQL and PHP, so sorry if this is a really stupid question! Any help much appreciated.

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 27 April 2006 - 03:17 AM

There are a number of ways to handle multi-table deletes -- you want want to look at the other syntax in the refman; also consider using JOINs.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users