Using alias names in group by clause [message #372845] |
Tue, 13 March 2001 10:23 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Alex
Messages: 190 Registered: August 1999
|
Senior Member |
|
|
Hi All,
Any help will be greatly appreciated. I am trying to build a sql statement that uses alias names in the group by clause. I keep getting the error 'Invalid Column Name'. I need to have alias names in the group by because this will be a dynamic generated query, and the column names may change.
Here is the sql:
SELECT s.student_lname alias1, s.student_fname alias2, s.student_id alias3,
a.log_category alias4, count(DISTINCT a.lo_id) alias5,
min(a.log_datetime) alias6 , max(a.log_datetime) alias7 FROM access_history a,student s
WHERE ( a.student_id = s.student_id ) and s.theme_id='xyz'
group by alias1,alias2,alias3,alias4
Please help...
Thank you,
Alex
|
|
|
|
|
|
|
|