On 02/03/2014 01:01 PM, Susan Cassidy
wrote:
Sorry this is what I meant to post select s.s1, s.s2, ( CASE when (s.s1 = 'absolute root'::text) then 1 when (s.s1 ~* '^root*') then 2 else 3 END) as v from scripts as s order by v,s1 toys-# ; s1 | s2 | v -------------------+---------+--- absolute root | | 1 root 3 | Scene 1 | 2 root 4 | Scene 2 | 2 root 6 | Scene 3 | 2 18 cm long wrench | Scene 1 | 3 blue screwdriver | Scene 1 | 3 red toolbox | Scene 1 | 3 small wrench | Scene 1 | 3 tire | Scene 2 | 3 (9 rows) |