Re: How to group a cunction column?

From: Matthew M. Lih <lih_at_venice.sedd.trw.com>
Date: 1996/01/31
Message-ID: <310FD16D.F69_at_venice.sedd.trw.com>#1/1


sl6gs_at_cc.usu.edu wrote:
>
> Hi Everyone:
>
> I wanted to group a function value
> but it did not work. Code list as flwing:
>
> create view SurgView1
> (Surgeon, age,open,close)
> as
> Select S1.surg_name, agethen(e1.rep_date, d1.dob), sum(e1.open),
> sum(closeno(e1.open))
> from surgeons s1,pt_demo d1, pt_event1 e1, cathdate
> where d1.card_no = e1.card_no
> and s1.surg_no = e1.surg_no
> and e1.class ='S'
> and cathdate.seqno =1
> and e1.rep_date <= cathdate.date2
> and e1.rep_date >= cathdate.date1
> group by s1.surg_name, agethen(e1.rep_date, d1.dob)
> ;
> { end of code list}
>
 

> group by s1.sur_name, agethen(e1.rep_date, d1.dob)
> did not work
>

I think you need to alias the columns.

Try altering as follows:

Select S1.surg_name column1, agethen(e1.rep_date, d1.dob) column2, 
                        ^^^^^^^                               ^^^^^^^
Then:

group by column1, column2

should group things as you want.

I havent' had to do this myself, but I think it should work.

Matthew M. Lih
Software Lead, SAIN Project
TRW Enterprise Solutions Received on Wed Jan 31 1996 - 00:00:00 CET

Original text of this message