This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: SQL Query - query  (Read 1077 times)

Rotcoin

  • Registred Member
  • MWCS Enthusiast
  • *****
  • Posts: 2
    • View Profile
SQL Query - query
« on: March 29, 2015, 06:11:50 pm »
Long time lurker, first time poster.

I'm currently working on a project and have a query in regards to some SQL that I'm working on. We're looking to remove stats from all weapons and armour and I'm unsure if my query is targeting the right class.

UPDATE `Item_template` SET stat_value1 = (stat_value1 = 0) WHERE class = 2;
UPDATE `Item_template` SET stat_value2 = (stat_value2 = 0) WHERE class = 2;
UPDATE `Item_template` SET stat_value3 = (stat_value3 = 0) WHERE class = 2;
UPDATE `Item_template` SET stat_value4 = (stat_value4 = 0) WHERE class = 2;
UPDATE `Item_template` SET stat_value5 = (stat_value5 = 0) WHERE class = 2;
UPDATE `Item_template` SET stat_value6 = (stat_value6 = 0) WHERE class = 2;
UPDATE `Item_template` SET stat_value7 = (stat_value7 = 0) WHERE class = 2;
UPDATE `Item_template` SET stat_value8 = (stat_value8 = 0) WHERE class = 2;

UPDATE `Item_template` SET stat_value1 = (stat_value1 = 0) WHERE class = 4;
UPDATE `Item_template` SET stat_value2 = (stat_value2 = 0) WHERE class = 4;
UPDATE `Item_template` SET stat_value3 = (stat_value3 = 0) WHERE class = 4;
UPDATE `Item_template` SET stat_value4 = (stat_value4 = 0) WHERE class = 4;
UPDATE `Item_template` SET stat_value5 = (stat_value5 = 0) WHERE class = 4;
UPDATE `Item_template` SET stat_value6 = (stat_value6 = 0) WHERE class = 4;
UPDATE `Item_template` SET stat_value7 = (stat_value7 = 0) WHERE class = 4;
UPDATE `Item_template` SET stat_value8 = (stat_value8 = 0) WHERE class = 4;

To me, that logically makes sense. But I'm just wondering if anyone would be able to give it a quick look over and see if it is correct?

Thank you in advance for any help.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Kaev

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 308
    • View Profile
Re: SQL Query - query
« Reply #1 on: March 29, 2015, 08:08:42 pm »
UPDATE `Item_template` SET stat_value1 = 0 WHERE class = 2;
etc.
stat_value1 = (stat_value1 = 0) doesn't make any sense at all.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Rotcoin

  • Registred Member
  • MWCS Enthusiast
  • *****
  • Posts: 2
    • View Profile
Re: SQL Query - query
« Reply #2 on: March 29, 2015, 08:48:33 pm »
Aaah. I was basing my SQL query off of one which was previously used for a server where they were boosting all the stats up on items by a percentage.

Initially it was; stat_value1 = stat_value1 * 1.15

Thus adding 15% to all stats.

Thank you for the help and clarification, Kaev. It's really appreciated.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Steff

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 4551
    • View Profile
Re: SQL Query - query
« Reply #3 on: April 05, 2015, 12:20:29 pm »
But why so many comands?

UPDATE `Item_template` SET stat_value1 = stat_value1 * 1.15, stat_value2 = stat_value2 * 1.15, stat_value3 = stat_value3 * 1.15, stat_value4 = stat_value4 * 1.15, stat_value5 = stat_value5 * 1.15, stat_value6 = stat_value6 * 1.15, stat_value7 = stat_value7 * 1.15, stat_value8 = stat_value8 * 1.15 WHERE class = 2;
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Please mark as solved if solved.
Don't ask if you could ask a question... JUST ask the Question.
You can send me also offline messages. I will answer if I get online.
Skype: project.modcraft
Discord: steff#6954