How do I combine 3 queries into one
I have three insert queries created:
$result = mysql_query("INSERT INTO item_cat_associations (item_id) SELECT stuff.item_id FROM stuff WHERE stuff.item_id = LAST_INSERT_ID()",$connect);
$result=mysql_query("INSERT INTO item_cat_associations(cat_id) VALUES ('$HTTP_POST_VARS[cat]')", $connect);
$result=mysql_query("INSERT INTO item_cat_associations(sub_id) SELECT subcategory.sub_id FROM subcategory WHERE subcategory.subcategory=('$HTTP_POST_VARS[subcat]')",$connect);
My problem is that , I think, because these are 3 queries, my data into my item_cat_associations table appears three times, so that I have 3 primary key ids for one result.
Can I combine these three queries into one so that I only get one result id?
Subject
Written By
Posted
How do I combine 3 queries into one
April 12, 2009 07:37PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.