| От | silly sad |
|---|---|
| Тема | Re: How to max() make null as biggest value? |
| Дата | |
| Msg-id | 4BCEAC8A.80208@bankir.ru обсуждение исходный текст |
| Ответ на | How to max() make null as biggest value? (Feixiong Li <feixiongli@gmail.com>) |
| Список | pgsql-sql |
On 04/14/10 08:33, Feixiong Li wrote: > Hi , guys , > > I am newbie for sql, I have a problem when using max() function, I need > get null when there are null in the value list, or return the largest > value as usual, who can do this? > > i.e. max([1,2,3,4,5]) => 5 > max([1,2,3,4,5,null]) => null if u want a function, not an aggregate then u have the greatest(...) except it does not return null on null input (i was really surprised with this completely perverted behavior (very unusual for postgres), but it is a fact) if u want to cheat u may just coalesce() each input argument then nullif() a result of the greatest() function (if only u have enough space in a reference range to room the one special value instead of null)
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера