SQL question (concatenating values)

Machiavelli24

Mod creator
Joined
May 9, 2012
Messages
818
I am trying to create two hidden buildings for each religion that I can use to track when a city adopts a specific religion and if it is the first time a city adopts a specific religion. While I could hard-code the two buildings for the current 12 religions but I would prefer to do it in SQL so that it will work with new religions that may be added in the future (or with a mod that adds/renames religions).

I believe there would be two steps to what I am trying to do:

1) Add entries to BuildingClasses, I would need to do this twice:
Code:
INSERT INTO BuildingClasses(Type, DefaultBuilding, Description)
SELECT 'BUILDINGCLASS_'||Type, 'BUILDING_'||Type, Description
FROM Religions

2) Add entries to Buildings, I would need to do this twice:
Code:
INSERT INTO Buildings(Type, BuildingClass, Description, NukeImmune, ConquestProb)
SELECT 'BUILDING_'||Type, 'BUILDINGCLASS_'||Type, Description, 'true', 100
FROM Religions

Is this correct or is there something I am missing?
 
Back
Top Bottom