I have 2 tables.
Tbl_Data_Call_Questions has these fields
Tbl_Data_Call_Variables has these fields
I need to have a query that, if Modifiable_Question is NULL, then use Static_Question, which I have below.
However, if Modifiable_Question is not null, then it will contain a place Holder which must be filled in by the corresponding field in Tbl_Data_Call_Variables.
So, if Modifiable_Question contained this text: "Were you born in $$Q03_Data$$ in $$Q04_Data$$?"
And the corresponding row in Tbl_Data_Call_Variables contained:
The query would result in Question being "Were you born in 1953 in Milwaukee?"
Here is my current SQL syntax. How do I modify it to incorporate the variable data?
I CANNOT predict which question will hold which place holder or how many place holders it will have.
SELECT dbo.Tbl_Data_Call_Questions.Sequence_Number, CASE WHEN Modifiable_Question IS NULL
THEN Static_Question ELSE Modifiable_Question END AS Question
FROM dbo.Tbl_Data_Call_Questions INNER JOIN
dbo.Tbl_Data_Call_Variables ON dbo.Tbl_Data_Call_Questions.ID = dbo.Tbl_Data_Call_Variables.ID