Re: SELECT, GROUP BY, and aggregates

Поиск
Список
Период
Сортировка
От Igor Neyman
Тема Re: SELECT, GROUP BY, and aggregates
Дата
Msg-id A76B25F2823E954C9E45E32FA49D70ECC22A1CA0@mail.corp.perceptron.com
обсуждение исходный текст
Ответ на Re: SELECT, GROUP BY, and aggregates  (Brian Dunavant <brian@omniti.com>)
Список pgsql-general

-----Original Message-----
From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Brian Dunavant
Sent: Friday, February 13, 2015 2:11 PM
To: Bill Moran
Cc: Jeff Janes; Ryan Delaney; pgsql-general@postgresql.org
Subject: Re: [GENERAL] SELECT, GROUP BY, and aggregates

To lower the amount of time spent copy pasting aggregate column names, it's probably worth noting Postgres will allow
youto short cut that with the column position.  For example:
 

select long_column_name_A, long_column_name_b, count(1) from foo group by 1,2 order by 1,2

This works just fine.  It's not in the spec, but postgres supports it.
I'll leave it to others to argue about it being a best practice or not.

-----------------------

I use this feature a lot.

Igor Neyman

В списке pgsql-general по дате отправления:

Предыдущее
От: Brian Dunavant
Дата:
Сообщение: Re: SELECT, GROUP BY, and aggregates
Следующее
От: Christopher Currie
Дата:
Сообщение: How can I refer to an ANYELEMENT variable in postgresql dynamic SQL?