All pastes #784115 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-11-19 15:37 UTC
rendered paste body
select 
                        injectabledrug.name as drug, 
                        patient.lastname patientlast, 
                        patient.firstname patientfirst, 
                        insurancecompany.name as plan, 
                        lob.name as lobname, 
                        round((unix_timestamp(NOW())-unix_timestamp(injectableorder.createdate))/3600,0) as hoursold, 
                        injectableorder.injectableorderID, 
                        mcouser.lastname userlast,
                        mcouser.firstname userfirst
                from 
                       injectableorder
JOIN injectabledrug 
JOIN insurancecompany
JOIN patient
JOIN lob
                left join
                       (mcouser)
                    on 
                (injectableorder.speccsr = mcouser.mcouserID)
  where 
                       injectableorder.createdate between '2007-10-01 00:00:00' and '2007-11-30 23:59:59' and 
                       injectabledrug.injectabledrugID = injectableorder.injectabledrugID and 
                       insurancecompany.insurancecompanyID = injectableorder.insurancecompanyID and 
                       injectableorder.lobID = lob.lobID and 
                       patient.patientID = injectableorder.patientID and 
techreviewed = '' AND 
accepted = '' AND 
cancelled != 'Y' AND 
closed != 'Y' "