DaVuLf Posted January 2, 2007 Share Posted January 2, 2007 Hey there,I know this is something that is really easy to do in something like Access, so I'm hoping its easy to do with PHP as well. I'm running a SQL backend, but I think that since the code itself is PHP, this is the proper place to post. Now then, I have a table set up as follows:[code]TEAM FIELD VALUE[/code]Pretty simple, I know. So the value can either be zero, or non-zero. What I need to do is to separate the non-zero entries, and then update them with values from another table. The problem is that a team could have more than one entry if it has different fields. For example, team 1 has field 2,3 and 4, all with non-zero entries. However, team 1 also has field 1 and 5 with zero in them. This means that I would need to update the fields 2,3 and 4 for team 1 and leave the other two unchanged.Now let's throw in some more complexity. I have a separate table for every field, they are all identical, and are as follows:[code]NUMBER VALUE[/code][sup]*The name of the table is field 'x' (where x denotes the number)[/sup]I need to take the values at 'NUMBER' = 60, and put them in the other table to replace the ones I had previously. Essentially I'm matching the values in the first table with those in the second, while adding a few conditions. I hope this was clear, if you have any further questions or need more elaboration, please don't hesitate to ask.Thank you,DaVuLF Quote Link to comment https://forums.phpfreaks.com/topic/32628-multi-threaded-merge-update-query/ Share on other sites More sharing options...
DaVuLf Posted January 3, 2007 Author Share Posted January 3, 2007 I think this would be like in access where you link two fields of the table, and pull down the third... Is this not possible in mySQL (ie, to set relationships?).Thanks,DaVuLF Quote Link to comment https://forums.phpfreaks.com/topic/32628-multi-threaded-merge-update-query/#findComment-152375 Share on other sites More sharing options...
DaVuLf Posted January 5, 2007 Author Share Posted January 5, 2007 Well... I figured out how to do it by improvising. Using several while loops, about a dozen queries, and the SELECT SUM features.Thanks,DaVuLf Quote Link to comment https://forums.phpfreaks.com/topic/32628-multi-threaded-merge-update-query/#findComment-153230 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.