SQL Script help

Howdy all

I need a little sql scripting help. I am trying to scale some epic items to give incentive to running the vanilla BC raids at least once. I have come up with the forumula I want to use but am having an issue tying it together with sql selection.

Ok so I want to run this scaling forumula on all items

where quality=4
and RequiredLevel>=60
and
stat_type1=5 (will run the script individually for each stat type column and stat type we want).

The forumula

modify stat_value1 = (400/itemLevel)*stat_value1 (will use a rounding function on result)

so for example an item with a quality=4 and requiredLevel=60 and itemLevel=71 with a stat_type1=5 and a stat_value1=14 would have its stat_value1 modified to
stat_value1=84
SELECT ROUND((420/71)*14);

I would really appreciate any help. I just have not been able to google the specific results I am looking for. I am not very skilled with sql. Though I have learned quite a bit so far working with trinity.

Thanks
Foxtrot7

made you a PHP script, much easier.

tested it :

stat_type1 is the one with 5, value is 10, itemlevel is 200 for the sake of the test.

400/200 = 2 * 10 = 20, should update to 20.

before : http://puu.sh/37ycZ.png

after : http://puu.sh/37ykb.png

code :

http://paste2.org/hdhXvN7m

note : script automatically checks for every stat type == 5, just run once.

note II : you need to fill in correct DB credentials if you want it to work.

BIG NOTE : ALWAYS BACKUP YOUR DB BEFORE PERFORMING ANY DB TRANSACTIONS, I AM NOT RESPONSIBLE FOR ANY DAMAGE THIS SCRIPT MAY CAUSE.

Peace out.

Great to see when you put effort in something that people just don’t reply back.

Update item_template set stat_value1 = XXX Where quality = 4 And Requiredlevel =60; should work great.