Search Postgresql Archives

Re: ORDER BY 'DK', 'DE', DESC?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Adam Ruth <aruth@intercation.com> writes:

> Due to the sorting of boolean values, you'd need:
> 
> ORDER BY language = 'DK' desc, language like '%DE' desc, language;

Personally I find something like this clearer:

ORDER BY (CASE WHEN language = 'DK' THEN 1
               WHEN language like '%DE' THEN 2
               WHEN ...
               ELSE 5
               END
         )

-- 
greg


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux