Too dump for SQL?

Alewx

Chieftain
Joined
Jun 22, 2012
Messages
45
Location
Lübeck Germany
Spoiler :
Code:
UPDATE Buildings Set SpecialistCount = SpecialistCount * 2 WHERE 'SpecialistType'<>'SPECIALIST_ARTIST';
UPDATE Buildings Set SpecialistCount = SpecialistCount * 2 WHERE 'SpecialistType'<>'SPECIALIST_SCIENTIST';
UPDATE Buildings Set SpecialistCount = SpecialistCount * 2 WHERE 'SpecialistType'<>'SPECIALIST_MERCHANT';
UPDATE Buildings Set SpecialistCount = SpecialistCount * 4 WHERE 'SpecialistType'<>'SPECIALIST_ENGINEER';
This is my SQL code, the SpecialistCount * 2 thing could be done with an OR condition but, my problem is that it is ignoring the WHERE, it changes the SpecialistCount for all types and not the of the WHERE condition.
Can anyone help, I guess it is something simple, but i can't figure out what.
Greetings Alewx
 
You are comparing two strings

Code:
'SpecialistType'<>'SPECIALIST_ARTIST'

not the contents of a field and a string

Code:
SpecialistType<>'SPECIALIST_ARTIST'

PS: And an IN () would be better than lots of ORs
 
Code:
UPDATE "Buildings" SET SpecialistCount = SpecialistCount*2 WHERE SpecialistType = 'SPECIALIST_ARTIST';
UPDATE "Buildings" SET SpecialistCount = SpecialistCount*2 WHERE SpecialistType = 'SPECIALIST_SCIENTIST';
UPDATE "Buildings" SET SpecialistCount = SpecialistCount*2 WHERE SpecialistType = 'SPECIALIST_MERCHANT';
UPDATE "Buildings" SET SpecialistCount = SpecialistCount*4 WHERE SpecialistType = 'SPECIALIST_ENGINEER';

Works not sure if its the right way or not though :)
 
Code:
UPDATE "Buildings"
  SET SpecialistCount = SpecialistCount*2
  WHERE SpecialistType IN ('SPECIALIST_ARTIST', 'SPECIALIST_SCIENTIST', 'SPECIALIST_MERCHANT', 'SPECIALIST_ENGINEER');
 
@Whoward69 nice and elegant, THX.:D

Did anyone notice that there is a specialist cap, somewhere in the believe lua files, I believe. in city screen you can only get acess to maximum of 3, altough the defines set a maximum of 4 per building.
 
Back
Top Bottom