deleting rows with composite primary key

From: Date: Tue, 18 May 2010 17:14:44 +0000
Subject: deleting rows with composite primary key
Groups: php.db 
Request: Send a blank email to php-db+get-47178@lists.php.net to get a copy of this message
Is there a different syntax to the mysql delete statement when the "WHERE" clause points only to half of the primary key? The structure is as follows: CREATE TABLE IF NOT EXISTS table1 ( id1 int(10) unsigned NOT NULL, id2 int(10) unsigned NOT NULL, PRIMARY KEY (id1,id2), KEY id2 (id2) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; Query is $query = "DELETE * FROM table1 WHERE id1 = '$recID';"; Error is a 1064 syntax error. Any help is appreciated. Eli

« previous php.db (#47178) next »