Kryptix Posted February 14, 2010 Share Posted February 14, 2010 UPDATE `rscd_quests` SET (`quest_stage`, `finished`) VALUES ('0', '0') WHERE `user` = '0' AND `quest_id` = '0' Is it possible to insert into another table too within the same query? Say for example I wanted to do the exact same but into `rscd_quests2` as well. Link to comment https://forums.phpfreaks.com/topic/192031-inserting-into-2-different-tables-at-once/ Share on other sites More sharing options...
kickstart Posted February 14, 2010 Share Posted February 14, 2010 Hi You can update to multiple table (doing a join) but don't think you can do an insert. If they need to happen at the same time you need to wrap them in a transaction. All the best Keith Link to comment https://forums.phpfreaks.com/topic/192031-inserting-into-2-different-tables-at-once/#findComment-1012120 Share on other sites More sharing options...
Kryptix Posted February 14, 2010 Author Share Posted February 14, 2010 Hm, OK. Could you show me how to do an UPDATE JOIN please? Link to comment https://forums.phpfreaks.com/topic/192031-inserting-into-2-different-tables-at-once/#findComment-1012163 Share on other sites More sharing options...
kickstart Posted February 14, 2010 Share Posted February 14, 2010 Hi Something like this UPDATE `rscd_quests`a INNER JOIN `rscd_quests2` b ON a.`user` = b.`user` AND a.quest_id = b.quest_id SET quest_stage = '0', `finished` = '0' WHERE a.`user` = '0' AND a.`quest_id` = '0' All the best Keith Link to comment https://forums.phpfreaks.com/topic/192031-inserting-into-2-different-tables-at-once/#findComment-1012180 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.