Chud37 Posted August 31, 2011 Share Posted August 31, 2011 hello; I need to update a main table called 'programs' which is linked via two JOINS to a `Module` table and a `Language` table. Both the Language and the Module table have two columns, 'ID' and either 'Module' or 'Language'. I would like to be able to update all of these with a single SQL statement, however I am not able to get the INSERT to function on more than one table. So I am having to then update each table one by one. Which is problem no.1. if that isnt possible, then problem no.2. is looping through the data, and putting the information not only in the programs table, but into the Modules and Languages table to, and then keeping the two linking fields in `Programs` the same as the corresponding fields in both `Modules` and `Language`. i hope I have made myself clear. Does anyone have any solution to how I can code this, as i could really do with some help. Thanks, Chud37 Quote Link to comment Share on other sites More sharing options...
fenway Posted September 1, 2011 Share Posted September 1, 2011 I don't follow. INSERT doesn't update. Quote Link to comment Share on other sites More sharing options...
Chud37 Posted September 1, 2011 Author Share Posted September 1, 2011 No, okay, I dont want to Update, I was confusing English with SQL commands. I want to Insert new rows onto three tables at once, sort of. Quote Link to comment Share on other sites More sharing options...
Chud37 Posted September 1, 2011 Author Share Posted September 1, 2011 This Is my SQL to retrieve info: SELECT pID, airdate, title, summary, duration, url, public, modTitle, Language FROM `Programs` JOIN Modules ON Programs.mID = Modules.ID JOIN Languages ON Programs.vID = Languages.ID ORDER BY title ASC; and the Modules and Languages tables simply have ID and then [modTitle] and [Language] fields. For some reason the above SQL statement was working, but isnt anymore. I dont know why this is. I hope t his explains it a bit better. Quote Link to comment Share on other sites More sharing options...
fenway Posted September 1, 2011 Share Posted September 1, 2011 What do you want to insert? How is it 3? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.