SELECT
too_code toolcode,
too_org toolorganization,
too_desc tooldescription,
COALESCE(mt.mrt_qty * mt.mrt_hours,0) capavailable,
too_class toolclass,
too_class_org toolclassorg,
COALESCE(mt.mrt_tariff,0) rate
FROM r5tools t
LEFT OUTER JOIN r5mrctools mt ON t.too_code=mt.mrt_tool AND mt.mrt_mrc=COALESCE(<parameter.mrc>,'-') AND mt.mrt_org=<control.org>
WHERE 1=1
