0

I have two tables A and B. I want to update rows in Table A depending on the back up data stored in Table B.

Table A = most current table of data
Table B = 5 day old back up of table A

Structure of both Table A and B:

item_id(unique int), item_type(int), enchant(int)

I have a list(array) of 'item_type':

item_type[] = 1, 5, 6, 7, 10

For each row in Table B with item_type == 1, 5, 6, 7, or 10 the script should add 5 + 'enchant' and store this updated data in Table A WHERE TableA.item_id == TableB.item_id.

Please help! =)

If you didn' understand that please ask and I'll try to explain it better. (BTW, this script will be helping an online gaming community of over 2000 users)

2
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by goodtimeshaxor
0

I think you want to use the IN operator. The IN operator will take the left variable and check it against a comma delimited list (each item enclosed in single quotes if its a character string, without them otherwise) and return true if its in there. Is this what your looking for?

Update TableA,TableB
Set TableA.enchant = TableB.enchant + 5
Where 
TableA.item_id = TableB.item_id
AND TableB.item_type IN (1,5,6,7,10)
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.