Help: Flexible SQL SELECT !!
Posted in 1995
Topics: General Discussion
I have a table of patient code, every patient with a card_no(unique) but each card_no with multi DIAG_COD NO, I can not figure out how to find a patient with several DIAG_COD at same time, say I want to use SQL find all the patients with both DIAG_COD 621.100 and 303.500 or with 621.100 and 303.500 and 339.000 even more. sample table as following SQL> SELECT * FROM PT_CODE 2 WHERE CARD_NO = '10007'; Card_no WHEN C P DIAG_COD C REP_NO ----- --------- - - --------- - --------- 10007 17-MAR-89 0 T 621.100 A 010007 17-MAR-89 0 T 621.100 A 0 10007 11-MAR-88 0 T 621.100 B 0 10007 17-MAR-89 0 T 621.100 B 0 10007 04-SEP-87 0 T 621.100 A 0 10007 04-SEP-87 0 T 339.000 B 0 10007 15-JUL-87 0 T 621.100 C 0 10007 15-JUL-87 1 T 303.500 C 0 10007 11-MAR-88 0 T 621.100 A 0 10007 11-MAR-88 0 T 621.100 B 0 10007 21-SEP-92 0 T 621.100 A 0 10007 14-OCT-91 0 T 621.100 A 0 Any suggestion? Thanks in advance. Wei JIang |||||||| | ~ ~ | (| @ @ |) ----------------oOOo---(__)---oOOo------------------------