Example Sample Master Oracle 10g Source data
The following query is used when the Orders Table Included field is UNCHECKED. Please note, example show table owner as SMXPSU, you will need to adjust depending on your configuration.
SELECT o.site as LOCCode, r.param as ACode, o.matrix as matrix, r.result as Result, o.collectdate as COLDate,
r.Qualifier as DataQualifier, r.samplenumber as SampleNumber, r.units as Units
FROM SMXPSU.results r, SMXPSU.orderdetails o
WHERE o.samplenumber=r.samplenumber and r.resultstatus=3
AND r.result is not null and o.site is not null
AND r.approveddate> TO_DATE('16-Apr-2012 12:00:00 AM', 'dd-Mon-yyyy HH:MI:SS AM')
AND r.approveddate< TO_DATE('19-Apr-2012 12:25:00 PM', 'dd-Mon-yyyy HH:MI:SS AM')
ORDER BY o.collectdate
The following query is used when the Orders Table Included field is CHECKED.
SELECT o.site as LOCCode, r.param as ACode, o.matrix as matrix, d.projectID as projectID,
r.result as Result, o.collectdate as COLDate, r.Qualifier as DataQualifier, r.samplenumber as SampleNumber, r.units as Units
FROM SMXPSU.results r, SMXPSU.orderdetails o
LEFT OUTER JOIN SMXPSU.orders d ON o.orderid=d.orderid
WHERE o.samplenumber=r.samplenumber and r.resultstatus=3 and r.result is not null and o.site is not null
AND r.approveddate> TO_DATE('16-Apr-2012 12:00:00 AM', 'dd-Mon-yyyy HH:MI:SS AM')
AND r.approveddate< TO_DATE('19-Apr-2012 12:25:00 PM', 'dd-Mon-yyyy HH:MI:SS AM')
ORDER BY o.collectdate
NOTE: LEFT OUTER JOIN is NOT supported in Oracle 8, therefore if connecting to a Sample Master Oracle 8 database please contact Tech Support.