The query is currently:
select sti.description, sc.description from scene_thing_instances sti
left outer join scenes sc on sti.scene_id = sc.scene_id
order by sti.description, CASE
when (sti.description = 'absolute root'::text) then 1
when (sti.description ilike 'root%') then 2
else 3
END;
The results I want are:
description | description
-------------------+-------------
absolute root |
root 3 | Scene 1
root 4 | Scene 2
root 6 | Scene 3
18 cm long wrench | Scene 1
blue screwdriver | Scene 1
red toolbox | Scene 1
small wrench | Scene 1
tire | Scene 2
(9 rows)