hi guys: I'm using int[] in postgrsql to store int array. I want to get max value of each row . While I can't find any function to get it(max function will get max array in one column) . Even I could write a sql function to get the max value. I still think a native funtion is better . Can your guys help me? Thanks
On Thu, Jun 2, 2011 at 10:52 PM, fanngyuan <fanngyuan@gmail.com> wrote: > hi guys: > I'm using int[] in postgrsql to store int array. I want to get max value > of each row . While I can't find any function to get it(max function will > get max array in one column) . Even I could write a sql function to get the > max value. I still think a native funtion is better . Can your guys help me? Please post questions like this to pgsql-general, rather than here. What you are looking for is unnest: rhaas=# select max(x) from unnest(array[1,2,3]) x;max ----- 3 (1 row) -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера