| От | Bruno Wolff III |
|---|---|
| Тема | Re: SQL Order Question |
| Дата | |
| Msg-id | 20060504194011.GA15993@wolff.to обсуждение исходный текст |
| Ответ на | SQL Order Question (<operationsengineer1@yahoo.com>) |
| Список | pgsql-novice |
On Thu, May 04, 2006 at 11:33:33 -0700, operationsengineer1@yahoo.com wrote: > hi all, > > i want to order contract numbers id ascending order, > with the exception of 'BTS' that I want to display > first. the contract numbers are numeric and 'BTS' is > text. the numeric values come first when i sort in > asc order - as expected. how can i get BTS (id = 0) > to come up as the first value in my query? You can first order by column <> 'BTS'. Ordering by the numeric values is trickier, but you should be able to have a case statement with a regular expression that checks for valid numbers and in that case return the string casted to numeric and for the invalid case return a constant numeric.
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера