Re: why I can't group by an expression
Posted in 1997
You could also use group by 1,2. Accomplishes the same thing albeit
without an alias. Saves a few keystrokes anyways.
On 29 Aug 1997 02:38:02 GMT, "Shannon Sellers"
<ssseller@concentric.net> wrote:
>
>I believe using "GROUP BY region, date" will group by month(date) using the
>alias "date"
>
>
>> I want to create a summary table aggregating the sales based on the
>> month and region. But in my base table, there is only a date field,
>> I have to use month(date) to get the month, but I can't use
>> "group by region, month(date)" to create the summary table.
>>
>> My SQL looks like:
>>
>> insert into sum_mon_reg
>> select region,
>> sum(sales) sum_sales,
>> month(date) date
>> from sales
>> group by region, month(date)
>>
>