Question: generate an sql query where we have to check whether the patients are double positive or triple postive based on the following condition: If MYC
generate an sql query where we have to check whether the patients are double positive or triple postive based on the following condition:
If MYC positive, BCL positive then double positive
If MYC positive, BCL positive then double positive
If MYC positive, BCL positive and BCL positive, then triple positive.
There are three columns to check it MYC BCLBCL which have corresponding values metioned in the above condition in their respective columns.
I have created a query as follows :
SELECT
CASE
WHEN "COUNTDISTINCTMYCMYC AND "COUNTDISTINCTBCLBCL THEN 'Double Hit'
WHEN "COUNTDISTINCTMYCMYC AND "COUNTDISTINCTBCLBCL THEN 'Double Hit'
WHEN "COUNTDISTINCTMYCMYC AND "COUNTDISTINCTBCLBCL AND "COUNTDISTINCTBCLBCL THEN 'Triple Hit'
ELSE 'None'
END AS HitStatus
FROM #table# AS "table";
but the output is returning the value double positive even if all the three columns contain the corresponding columns.
eg MYC is postive, BCL is positive, BCL is positive still returns double positive instead of triple positive.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
