DB2

DB2 sql: getting dob

September 30, 2011
By

Here is how to get the dob from LURS mainframe: SELECT MCARE_BRTH_DT FROM LURS.VLU_MEDICARE where MRN = ‘xxxxxxxx’ FETCH FIRST 1 ROW ONLY

Read more »

Extra Client: db2 access

August 30, 2011
By

Here is how to get to DB2 from Extra: TSOUSER Haygl1 after the ready prompt type in :”ISPF” PLP RACF LURS PURR FR2 tables. SELECT * FROM SYSIBM.SYSTABLES WHERE CREATOR = ‘LURS’ Select * from sysibm.systables where creator = ‘LURS’

Read more »

SQL: DB2 and blood cultures

August 30, 2011
By

C BL 6000501 C BL2 6000497 C BL3 6000495 C BL4 6000493 select * from LURS.VLU_LAB_RESULT where order_fac_id=’HAY’ and MRN = ‘xxxxxxxx’ and (PERFORMED_TEST_CD = ’1000878′ or PERFORMED_TEST_CD = ’1000778′) AND COLLECTION_DATE BETWEEN ’2009-12-01′ and ’2010-10-31′ ; (PERFORMED_TEST_CD = ’6000501′ or PERFORMED_TEST_CD = ’6000497′ or PERFORMED_TEST_CD = ’6000495′ or PERFORMED_TEST_CD = ’6000493′) So… select...

Read more »

SQL: DB2 and Na (sodium) between 90-133

August 30, 2011
By

SELECT substr(MRN,5) as ID, ORDER_FAC_ID as FACILITY, VERIFY_TECH_ID as TECH, PERFORMED_TEST_CD as TEST, TEST_RESULT as VAL, COLLECTION_DATE as COLLECTED FROM LURS.VLU_LAB_RESULT where COLLECTION_DATE BETWEEN ’2010-12-31′ AND ’2011-1-1′ AND PERFORMED_TEST_CD = ’1001700′ AND TEST_RESULT BETWEEN ‘ 90′ AND ‘ 133′ AND TEST_RESULT NOT LIKE ‘%TND%’ substr(MRN,5) truncates the mrn to only 8 digits

Read more »

SQL: DB2 and microbiology

August 30, 2011
By

Looking for blood cultures in the DB2 system in KPHC? Here is the SQL command: Here is the SQL statement I used: select distinct ORGANISM_CHRT_NAME, COLLECTION_DATE, ACCESSION_NUMB,PERFORMED_TEST_CD from LURS.VLU_MICRO_RESULT where order_fac_id=’HAY’ and MRN = ‘xxxxxxx’ and (PERFORMED_TEST_CD = ’6000501′ or PERFORMED_TEST_CD = ’6000497′ or PERFORMED_TEST_CD = ’6000495′ or PERFORMED_TEST_CD = ’6000493′) You may not...

Read more »

SQL: DB2 limiting the count of rows which you want to see

August 30, 2011
By

I always forget how to limit the number of rows which return using DB2 and sql. Well, here it is: using db2, you can limit the number or count of rows by using this at the END of an sql statement: FETCH FIRST 3 ROW ONLY This won’t work for MySQL or Clarity SQL...

Read more »