Bob,
I think MAX aggregate function choose the maximum values of one field (or expression) in a set of rows. Not the max
vauesof many fields.
----- Mensagem original -----
De: Bob Kruger [SMTP:bkruger@mindspring.com]
Enviada em: Quarta-feira, 10 de Fevereiro de 1999 16:43
Para: pgsql-sql@postgreSQL.org; pgsql-general@postgreSQL.org
Assunto: [GENERAL] Select max field
I am looking for a way to determine the largest value of a number of fields
in a tuple.
Example: In a table with the fields id_no, t1, t2 ,t3 ,t4 ,t5
Select the id_no and the greatest value from fields t1, t2, t3,
t4, t5.
I have tried the following, but with no success:
select id_no, max(t1, t2, t3, t4, t5) from table_1 ;
Anyone have any suggestions?
Thanks in advance for any assistance.
Regards - Bob
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера