case when null evaluates to false September 24, 2023 by Tarik Use something like case when p.parent_id is null then false else true end as has_parent