I am sorry for the confusing title, I’m not sure how to put into words what I am trying to do.
Anyway, I need to evaluate two columns Flu and Pneumonia. A calculated column evaluates if the row contains values in the two columns Flu and Pneumonia and returns Flu if the Flu column for that row contains anything and returns Pneumonia if the Pneumonia column for that row contains anything. The SQL is as follows:
CASE
WHEN FluSpecifics != '' THEN 'Flu'
WHEN PneumoniaSpecifics != '' THEN 'Pneumonia'
END as VaccineAdministered
However as you can see if a row contains information in both columns, my query will only care for values in the FluSpecifics column because in the code it comes first. To further clarify if the table looks like this:
FluSpecifics PneumoniaSpecifics
successful vaccine successful vaccine
The Calculated column VaccineAdministered will return Flu.
I need this column to return both if both exist. So I need it to create another row if both columns contain information. How can I do this?
Also, I need both columns to be compiled into one column called Specifics with PneumoniaSpecifics data corresponding to the row created that has “Pneumonia” in the VaccineAdministered field and FluSpecifics data corresponding to the row created that has “Flu” in the VaccineAdministered field.
If there is any further information you need, let me know.
I don’t care for exact syntax, I can find that out for myself (I am using Cache SQL). I would prefer to know a general method for doing this.
Thank you very much in advance
1 Answer