VTS Posted August 7, 2006 Share Posted August 7, 2006 I will try to lay this out the best that I can. I have a table that has the date, sales, department id, operating hours, and operating wages. I am getting the date, sales and department id from one place and then I am getting the operating hours and operating wages from another department. The major problem that I am having is that the place where I am getting the hours and wages from has some departements that the sales won't have and then the sales will have some departments that the hours and wages wont....does this mean I just need to make another table to store sales in one and wages and hours in another? Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted August 7, 2006 Share Posted August 7, 2006 I am not sure what you mean, but could something like [code]SELECT * FROM table1 AS t1 LEFT JOIN table2 AS t2 ON t1.department_id=t2.department_id[/code] do it? Quote Link to comment Share on other sites More sharing options...
simcoweb Posted August 7, 2006 Share Posted August 7, 2006 I think he means he needs to 'INSERT' data from multiple sources. Is that correct? ??? Quote Link to comment Share on other sites More sharing options...
VTS Posted August 7, 2006 Author Share Posted August 7, 2006 Well the problem was that one source will have wage data and the other source will have sales data and they will not always have the same departments. For example, the wage data my contain departments 1, 2, 3, 4, and 5 while the sales data may contain departments 1, 2, 3, 6, and 7. I was wondering how to go about inserting these into the datebase but I figured it out now. I just made a new table containing all the the departments and their id numbers. Then I used some sql and php to check and see what totals were missing and then if a total was missing, I just inserted zeroes into that row in the db. After doing this, all of my departments were accounted for and then I could just use a simple update statement to put the sales data in. Thanks for the posts guys!! 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.