Column Alias Not Allowed In Grouping Function

Поиск
Список
Период
Сортировка
От Vivek Suraiya
Тема Column Alias Not Allowed In Grouping Function
Дата
Msg-id 401489932.1675199.1660656779333@mail.yahoo.com
обсуждение исходный текст
Ответы Re: Column Alias Not Allowed In Grouping Function
Список pgsql-www
Suppose we have a table SALES with the following columns:
cust_name
sales_person_name
sale_amt

then the SQL command:

SELECT cust_name c , sales_person_name s , SUM(sale_amt) , GROUPING(c , s) grp
FROM SALES
GROUP BY CUBE(c,s)
ORDER BY grp;

will fail. But, 

SELECT cust_name c , sales_person_name s , SUM(sale_amt) , GROUPING( cust_name , sales_person_name)  grp
FROM SALES
GROUP BY CUBE(c,s)
ORDER BY grp;

will succeed.

Why is it illegal to use the column aliases in the GROUPING function?


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

Предыдущее
От: "Jonathan S. Katz"
Дата:
Сообщение: Re: UPSERT as a table name is confusing
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Column Alias Not Allowed In Grouping Function