Grouping
Posted in 2003
Topics: General Discussion
I always get an error " virtual column must have explicit name" I wrote a query to execute and store result in another table..I query does sum operation on fields with related keys....
On 28 Aug 2003 04:38:57 -0700, aksivaram2k2@yahoo.com (SRam) wrote:
>I always get an error " virtual column must have explicit name"
>
>I wrote a query to execute and store result in another table..I query does
>sum operation on fields with related keys....
If you're selecting into a temp table, then any column with aan
aggregate function requires a column name . . . . e.g.
select company, count(*) comp_count
from some_table
group by 1
into temp som_temp_table
JWC
On Thu, 28 Aug 2003 07:38:57 -0400, SRam wrote:
> I always get an error " virtual column must have explicit name"
>
> I wrote a query to execute and store result in another table..I query does
> sum operation on fields with related keys....
You need to name the virtual columns created by the SUM aggregation function
using a column alias, ala:
select colone, coltwo, SUM( colthree ) AS sum_of_three
from mytable
INTO TEMP my_temp_table;
This is because the corresponding column in the temp table needs a column name.
When you select from the temp table use the alias to identify the column that
resulted from the aggregation (SUM).
Art S. Kagel