Thanks! I found it.....
Remember when I mentioned earlier that what I was trying to do is "quite elaborate", well, I tried to translate what I am trying to do in to the syntax example you gave me and I keep getting an error that a key word is missing. Looks like they're all there to me. Would you mind taking a quick peek when you get a minute? Here it is:
SELECT "PERSON"."SEARCHNAME", "PERSON"."HOMELOCATION", "LOCREG"."ABBREVNAME", "PERSON"."ISPATIENT", "USRINFO"."LASTNAME", "USRINFO"."FIRSTNAME", "PERSON"."PID", "PROBLEM"."CODE", "PROBLEM"."DESCRIPTION", "PROBLEM"."XID", "PROBLEM"."QUALIFIER", "PROBLEM"."ONSETDATE", "PROBLEM"."CHANGE", "PROBLEM"."PRID", "PERSON"."EXTERNALID", "PERSON"."DATEOFBIRTH", "ORDERS"."ORDERDATE", "ORDERS"."CODE", "ORDDX"."RANK", "ORDDX"."DXCODE"
FROM ((("ML"."PERSON" "PERSON" INNER JOIN "ML"."LOCREG" "LOCREG" ON "PERSON"."HOMELOCATION"="LOCREG"."LOCID") INNER JOIN "ML"."USRINFO" "USRINFO" ON "PERSON"."RESPPROVID"="USRINFO"."PVID") INNER JOIN "ML"."PROBLEM" "PROBLEM" ON "PERSON"."PID"="PROBLEM"."PID")
Left Join (
SELECT "ORDERS"."PID", "ORDERS"."ORDERDATE", "ORDERS"."CODE", "ORDERS"."DESCRIPTION", "ORDDX"."RANK", "ORDDX"."DXCODE", "ORDDX"."DXDESC", "ORDERS"."ORDERID", "ORDERS"."XID"
FROM "ML"."ORDERS" "ORDERS" LEFT OUTER JOIN "ML"."ORDDX" "ORDDX" ON "ORDERS"."DXGROUPID"="ORDDX"."DXGROUPID"
WHERE "ORDERS"."ORDERDATE">={ts '2012-01-01 00:00:00'} AND ("ORDERS"."CODE" LIKE '%72100%' OR "ORDERS"."CODE" LIKE '%72110%' OR "ORDERS"."CODE" LIKE '%72114%' OR "ORDERS"."CODE" LIKE '%72120%' OR "ORDERS"."CODE" LIKE '%72131%' OR "ORDERS"."CODE" LIKE '%72132%' OR "ORDERS"."CODE" LIKE '%72133%' OR "ORDERS"."CODE" LIKE '%72148%' OR "ORDERS"."CODE" LIKE '%72149%' OR "ORDERS"."CODE" LIKE '%72158%') AND "ORDERS"."XID">=1.e+035) "ML"."ORDERS" "ORDERS" ON "PERSON"."PID"="ORDERS"."PID"
WHERE "PROBLEM"."XID">=1.e+035 AND ("PROBLEM"."CODE" LIKE '%721.3%' OR "PROBLEM"."CODE" LIKE '%721.90%' OR "PROBLEM"."CODE" LIKE '%722.10%' OR "PROBLEM"."CODE" LIKE '%722.52%' OR "PROBLEM"."CODE" LIKE '%722.6%' OR "PROBLEM"."CODE" LIKE '%722.93%' OR "PROBLEM"."CODE" LIKE '%724.02%' OR "PROBLEM"."CODE" LIKE '%724.2%' OR "PROBLEM"."CODE" LIKE '%724.3%' OR "PROBLEM"."CODE" LIKE '%724.5%' OR "PROBLEM"."CODE" LIKE '%724.6%' OR "PROBLEM"."CODE" LIKE '%724.70%' OR "PROBLEM"."CODE" LIKE '%724.71%' OR "PROBLEM"."CODE" LIKE '%724.79%' OR "PROBLEM"."CODE" LIKE '%738.5%' OR "PROBLEM"."CODE" LIKE '%739.3%' OR "PROBLEM"."CODE" LIKE '%739.4%' OR "PROBLEM"."CODE" LIKE '%846.0%' OR "PROBLEM"."CODE" LIKE '%846.1%' OR "PROBLEM"."CODE" LIKE '%846.2%' OR "PROBLEM"."CODE" LIKE '%846.3%' OR "PROBLEM"."CODE" LIKE '%846.8%' OR "PROBLEM"."CODE" LIKE '%846.9%' OR "PROBLEM"."CODE" LIKE '%847.2%') AND "PROBLEM"."CODE" NOT LIKE 'CPT%' AND NOT ("PROBLEM"."CHANGE"=10 OR "PROBLEM"."CHANGE"=11 OR "PROBLEM"."CHANGE"=12) AND "PERSON"."ISPATIENT"='Y'
ORDER BY "PERSON"."HOMELOCATION", "PERSON"."SEARCHNAME", "PERSON"."PID", "PROBLEM"."PRID", "PROBLEM"."ONSETDATE" "ORDERS"."ORDERDATE"
Posted : May 24, 2012 7:11 am