Re: delte stmt problem with joins
| From: | John W. Holmes | Date: | Fri, 29 Aug 2003 13:41:57 +0000 |
| Subject: | Re: delte stmt problem with joins | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-30226@lists.php.net to get a copy of this message | ||
Merlin wrote:
I would like to delete a row inside a mysql table. To find out which rows are affected the system has to check another table. Somehow I am doing this statement wrong and I cant find out why. Does anybody see the error? Thanx for any help on that. DELETE1. You're using MySQL 4, right? 2. Echo your query to the screen when you're having trouble. Ensure you really have a value for $table1, $table2, etc. 3. Try this format: DELETE $table1 FROM $table1 pi, $table2 p WHERE p.ID = pi.product_id AND p.owner_id = '15173' 4. If you're still having trouble, what does mysql_error() say after you execute the query? -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.comFROM $table1 piRIGHT JOIN $table2 AS p ON p.ID = pi.product_id WHERE p.owner_id = '15173'