Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Singleton error

Status
Not open for further replies.

Elroacho

Programmer
Apr 19, 2004
59
0
0
NZ
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top