Jump to content

Multi-Threaded 'merge' Update Query...


DaVuLf

Recommended Posts

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.