dbTalk Databases Forums  

Grouping

comp.databases.informix comp.databases.informix


Discuss Grouping in the comp.databases.informix forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
SRam
 
Posts: n/a

Default Grouping - 08-28-2003 , 06:38 AM






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....

Reply With Quote
  #2  
Old   
John Carlson
 
Posts: n/a

Default Re: Grouping - 08-28-2003 , 08:09 AM






On 28 Aug 2003 04:38:57 -0700, aksivaram2k2 (AT) yahoo (DOT) com (SRam) wrote:

Quote:
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


Reply With Quote
  #3  
Old   
Art S. Kagel
 
Posts: n/a

Default Re: Grouping - 08-28-2003 , 09:54 AM



On Thu, 28 Aug 2003 07:38:57 -0400, SRam wrote:

Quote:
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


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.