select
sp.safetyplanid
, sp.description
, h.hazardid
, h.description
, p.precautionid
, P.description
, p.siteid
from
safetyplan sp
join
spworkasset spwa
on sp.safetyplanid = spwa.safetyplanid
join
splexiconlink spll
on spwa.spworkassetid = spll.spworkassetid
sp.safetyplanid
, sp.description
, h.hazardid
, h.description
, p.precautionid
, P.description
, p.siteid
from
safetyplan sp
join
spworkasset spwa
on sp.safetyplanid = spwa.safetyplanid
join
splexiconlink spll
on spwa.spworkassetid = spll.spworkassetid
join
safetylexicon sl
on spll.safetylexiconid = sl.safetylexiconid
join
hazard h
on sl.hazardid = h.hazardid
left join
hazardprec hp
on h.hazardid = hp.hazardid
left join
precaution p
on hp.precautionid = p.precautionid
and hp.siteid = p.siteid
where
--and sp.safetyplanid = 'PIP'
--and h.hazardid = 'HEIGHT'
order by sp.safetyplanid, h.hazardid, p.precautionid
No comments:
Post a Comment