Implemented with lateral left join (requires 9.3)
Scalar subquery removes need for lateral left join