help with query: advanced ORDER BY...
От | |
---|---|
Тема | help with query: advanced ORDER BY... |
Дата | |
Msg-id | 00ac01c6192a$3c487460$6402a8c0@iwing обсуждение исходный текст |
Ответы |
Re: help with query: advanced ORDER BY...
|
Список | pgsql-novice |
hi list here's what i would like to do: table1: field0: id field1: boolean field2: numeric field3: varchar when selecting records from this table, i would like to have different sort orders depending if field1 is true or false: all records with field1 = true should be sorted with field2 first then field3, all records having field2 = false sorted by field3 first then field2. example: field0 | field1 | field 2 | field3 ------------------------------------------- 1 t 2 b 2 f 1 z 3 t 1 a 4 f 4 a desired output after sorting 4 f 4 a 2 f 1 z 3 t 1 a 1 t 2 b is this possible in a single query? (i hope my explanations make sense ;-)) - thomas
В списке pgsql-novice по дате отправления: