View Full Version : Update Multiple records

08-21-2005, 02:56 AM
I have another problem, does anyone know how to update multiple records at once? I would include the code, but it is like 4 different files and such. But I want to update different records at once using one line of SQL code.

If I am being too vague, please let me know. I will try and include some code then

08-21-2005, 03:05 AM
Okay, after reading my last post, I was too vague.

I am trying to develop a system that will track a number of pepole in a party in a game. Example, Party1 has 13 people playing; party2 has 7 people playing; and party3 has 19 pepole playing. I want to update the number of people in each party using one update.

I Hope that makes things clearer

08-22-2005, 12:41 PM
Here is your sql code (an example):

UPDATE table1, table2, table3 SET table1.party = 1, table2.party = 2, table3.party = 3 WHERE table1.id = 4, table2.id = 5, table3.id = 6


08-22-2005, 03:54 PM
cant you just use
SELECT Party, Count(id) As intPlayerCount FROM Players GROUP BY Party
to read it dynamically?

this would return data eg:
Party1 5
Party7 9
SomeGuysParty 2