Hi,
I had the following Select statement embedded as one of the rows of a bigger query:
(SELECT DISTINCT CLASSIFICATION.READCODE
FROM CLASSIFICATION
WHERE CLASSIFICATION.PATIENTID = ANYBODYPAT.PATIENTID AND
CLASSIFICATION.READCODE = 'C10.00' AND
CLASSIFICATION.ROWINACTIVE = 0) As DIA,
This would return 'C10.00' if a record was found and leave the column NULL if not.
I now need to look for the existence of one of 3 codes: C10.00, C108.00 and C109.00
I have the following code:
(SELECT DISTINCT CLASSIFICATION.READCODE
FROM CLASSIFICATION
WHERE CLASSIFICATION.PATIENTID = ANYBODYPAT.PATIENTID AND
(CLASSIFICATION.READCODE = 'C10.00' OR CLASSIFICATION.READCODE = 'C108.00' OR CLASSIFICATION.READCODE = 'C109.00')
AND
CLASSIFICATION.ROWINACTIVE = 0) As DIA,
but as you can imagine I get an error as there are times when there could be more than one code.
I would just like it to return a 1 if if find at least one of these codes and a 0 if not.
How can I do this?
Cheers in advance.
Kevin
I had the following Select statement embedded as one of the rows of a bigger query:
(SELECT DISTINCT CLASSIFICATION.READCODE
FROM CLASSIFICATION
WHERE CLASSIFICATION.PATIENTID = ANYBODYPAT.PATIENTID AND
CLASSIFICATION.READCODE = 'C10.00' AND
CLASSIFICATION.ROWINACTIVE = 0) As DIA,
This would return 'C10.00' if a record was found and leave the column NULL if not.
I now need to look for the existence of one of 3 codes: C10.00, C108.00 and C109.00
I have the following code:
(SELECT DISTINCT CLASSIFICATION.READCODE
FROM CLASSIFICATION
WHERE CLASSIFICATION.PATIENTID = ANYBODYPAT.PATIENTID AND
(CLASSIFICATION.READCODE = 'C10.00' OR CLASSIFICATION.READCODE = 'C108.00' OR CLASSIFICATION.READCODE = 'C109.00')
AND
CLASSIFICATION.ROWINACTIVE = 0) As DIA,
but as you can imagine I get an error as there are times when there could be more than one code.
I would just like it to return a 1 if if find at least one of these codes and a 0 if not.
How can I do this?
Cheers in advance.
Kevin