GsXtAsY Posted June 26, 2008 Share Posted June 26, 2008 ok i am going to try my best to explain what I need to do here...first off I need to add a new package to the website...the pkg_id = 86 What I need to do with that number is somehow in phpmyadmin add pkg_id = 86 to all accounts with the carrier_id = 6 now where this gets kinda confusing to me is the carrier_id is under the account table while pkg_id is under the accounts_pkgs table...is there a way to cross reference those two tables and then insert the new data into the accounts_pkgs table? and if so how would i go about writing that in SQL ??? Link to comment https://forums.phpfreaks.com/topic/112093-adding-new-plan-to-database/ Share on other sites More sharing options...
fenway Posted June 27, 2008 Share Posted June 27, 2008 say what? Link to comment https://forums.phpfreaks.com/topic/112093-adding-new-plan-to-database/#findComment-575593 Share on other sites More sharing options...
GsXtAsY Posted June 27, 2008 Author Share Posted June 27, 2008 I knew this would be confusing...its so hard to explain what i need to do...in other words ill try this approach... I want to: SELECT `carrier_id`, `pkg_id` FROM `account`, `accounts_pkgs` WHERE carrier_id=6 Then on that return I want to insert pkg_id = 86 to all of those results Hopefully that makes more sense Link to comment https://forums.phpfreaks.com/topic/112093-adding-new-plan-to-database/#findComment-575945 Share on other sites More sharing options...
fenway Posted June 27, 2008 Share Posted June 27, 2008 By "insert" you mean update the matching rows? Link to comment https://forums.phpfreaks.com/topic/112093-adding-new-plan-to-database/#findComment-575957 Share on other sites More sharing options...
GsXtAsY Posted June 27, 2008 Author Share Posted June 27, 2008 Thats correct...using INSERT I want to insert new rows to the accounts_pkgs table with all those that come up with the carrier_id = 6 Link to comment https://forums.phpfreaks.com/topic/112093-adding-new-plan-to-database/#findComment-575966 Share on other sites More sharing options...
fenway Posted June 27, 2008 Share Posted June 27, 2008 OK... so you need: INSERT INTO `accounts_pkgs` ( <column-list> ) SELECT <column-list> FROM `account` WHERE carrier_id=6 What will you be inserting? Link to comment https://forums.phpfreaks.com/topic/112093-adding-new-plan-to-database/#findComment-576139 Share on other sites More sharing options...
GsXtAsY Posted June 27, 2008 Author Share Posted June 27, 2008 I will be inserting pkg_id = 86 along with the account_id...which is pulling from all the accounts that the carrier_id = 6 Link to comment https://forums.phpfreaks.com/topic/112093-adding-new-plan-to-database/#findComment-576148 Share on other sites More sharing options...
GsXtAsY Posted June 27, 2008 Author Share Posted June 27, 2008 OK... so you need: INSERT INTO `accounts_pkgs` ( <column-list> ) SELECT <column-list> FROM `account` WHERE carrier_id=6 What will you be inserting? What do you mean by ( <column-list> )? Link to comment https://forums.phpfreaks.com/topic/112093-adding-new-plan-to-database/#findComment-576168 Share on other sites More sharing options...
fenway Posted June 27, 2008 Share Posted June 27, 2008 Well, I mean the columns in the target table... Link to comment https://forums.phpfreaks.com/topic/112093-adding-new-plan-to-database/#findComment-576279 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.