SELECT REA_METER AS PHYSICALMETER,
REA_CALCUOM AS UOM,
REA_DATE AS DATETIME,
REA_READING AS READING,
REA_DIFF AS DIFFERENCE,
REA_EVENT AS WORKORDERNUM,
REA_RELATEDEVENT AS RELATEDWORKORDER,
REA_CODE AS READINGCODE,
REA_TYPE AS ENTITYTYPE,
R5READINGS.DMLTYPE AS DMLTYPE
FROM r5readings
LEFT OUTER JOIN r5events ON ( evt_code = rea_event )
WHERE rea_object = <parameter.object>
AND rea_calcuom = <parameter.uom>
AND rea_object_org = <parameter.objectorg>
ORDER BY REA_DATE DESC
