0

i have a syntax error in this code, but i can't see where since i think that the code is right... i want to copy some column in the database named "w" (table creaturecache) and replace that data with the columns in the "world" database (table creature_template)

CODE:

UPDATE world.creature_template 
   SET name, `type`, family, rank, modelid2, modelid3, modelid4, Health_mod, movementId, IconName, KillCredit1, KillCredit2, type_flags, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6
SELECT male_name1, `type`, family, rank, modelId2, modelId3, modelId4, HealthModifier, movementId, icon_name, killcredit1, killcredit2, type_flags, QuestItem1, QuestItem2, QuestItem3, QuestItem4, QuestItem5, QuestItem6
  FROM w.creaturecache where world.creature_template.entry = w.creaturecache.entry;
Mahmut Ali ÖZKURAN
  • 1,120
  • 2
  • 23
  • 28
Elle
  • 1
  • 1
  • ps. At the moment the program says that the error is on line 2 (from type to movementId, i use Heidisql) – Elle Feb 04 '14 at 18:57
  • 1
    Yes, you have a syntax error. What is the syntax for UPDATE statements? – Strawberry Feb 04 '14 at 18:58
  • i found on google UPDATE table SET columns SELECT right_columns FROM right_database CONDITION – Elle Feb 04 '14 at 19:06
  • It would probably benefit your game for the long term if you'd properly normalize your tables. What if a create has more than 6 quest items, or 4 modelIDs? See this post for starting points. http://stackoverflow.com/questions/246701/what-is-normalisation-or-normalization – Andy Lester Feb 04 '14 at 19:10

1 Answers1

0

Such a joined table update is built differently:

UPDATE world.creature_template a, w.creaturecache b
SET a.name = b.male_name1,
a.`type` = b.`type`,
...
a.questItem6 = b.QuestItem6
WHERE a.entry = b.entry
LauriK
  • 1,899
  • 15
  • 20