If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Aliasing column in a view,

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-23-09, 15:40
Beebo Beebo is offline
Registered User
 
Join Date: May 2009
Posts: 19
Aliasing column in a view,

Guys,

Trying to do an aggregate function in InformiX, and alias the column as I place the syntax below into a view. I'm having problems, and keep getting this message. What's the deal?

"Need to specify view column names in the view definition"

CREATE VIEW tkt_chrg AS
SELECT a.traddate, a.source_acct, a.description, b.proddesc, a.buysell, a.shares, a.priceper,
a.invested, a.receivable, a.clearing, sum (a.receivable-a.clearing) as net
FROM
open_blot a, producttype b
WHERE a.prodtype = b.productype AND
a.prodtype in ('11','12') AND
a.traddate > = '01/01/2009'
group by 1,2,3,4,5,6,7,8,9,10
Reply With Quote
  #2 (permalink)  
Old 06-24-09, 10:00
mjldba mjldba is offline
Registered User
 
Join Date: Dec 2003
Location: North America
Posts: 139
You need to specify the column names in your view definition, INFORMIX won't implicitly assign column names from tables to the column names in your view so use something like this:

CREATE VIEW tkt_chrg (tr_dt, src_acct, descr, prod_descr, buysell, shares, unit_price, invested, recv, clearing, net) AS
SELECT a.traddate, a.source_acct, a.description, b.proddesc, a.buysell, a.shares, a.priceper,
a.invested, a.receivable, a.clearing, sum (a.receivable-a.clearing) as net
FROM
open_blot a, producttype b
WHERE a.prodtype = b.productype AND
a.prodtype in ('11','12') AND
a.traddate > = '01/01/2009'
group by 1,2,3,4,5,6,7,8,9,10
Reply With Quote
  #3 (permalink)  
Old 06-24-09, 10:03
Beebo Beebo is offline
Registered User
 
Join Date: May 2009
Posts: 19
MJL,

Many thanks! That was the trick/key! Please send me your address, so I can mail you a Christmas present.
Reply With Quote
  #4 (permalink)  
Old 06-24-09, 10:09
mjldba mjldba is offline
Registered User
 
Join Date: Dec 2003
Location: North America
Posts: 139
glad to help, have a great day!!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On