Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Oracle > Invalid Column: Group By with SELECT calc column

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-16-04, 09:34
WarrenM WarrenM is offline
Registered User
 
Join Date: May 2004
Location: NH
Posts: 87
Exclamation Invalid Column: Group By with SELECT calc column

Hi all,

Problem:
Code:
SELECT (FLOOR(( ACTIVITY_DATE - TO_DATE('05-01-04', 'MM-DD-YY') ) /7 )) As WEEKNO, SUM(some_data) FROM some_table WHERE TO_CHAR(ACTIVITY_DATE, 'MM-DD-YY') >= '05-01-2004' GROUP BY WEEKNO

Returns an invalid column name. I'm trying to sum columns based upon which week they fall into. If I take out the SUM and GROUP BY it works; I don't understand why I can't GROUP BY WEEKNO, I have an aggregate function in my select statement?

I've searched the web and can't find any answers and it's been about a day...

Any help would be greatly appreciated!

Thanks
Warren
Reply With Quote
  #2 (permalink)  
Old 06-16-04, 09:37
WarrenM WarrenM is offline
Registered User
 
Join Date: May 2004
Location: NH
Posts: 87
Oh, one more thing...

I have already tried moving the Week No calclution into the FROM clause in the form of it's own select statment and I still couldn't group by it after I referenced its alias... just in case someone was thinking of doing that.
Reply With Quote
  #3 (permalink)  
Old 06-16-04, 09:55
carloa carloa is offline
Registered User
 
Join Date: Apr 2003
Location: NY
Posts: 206
Code:
SELECT (FLOOR(( ACTIVITY_DATE - TO_DATE('05-01-04', 'MM-DD-YY') ) /7 )) FROM .... WHERE ..... GROUP BY (FLOOR(( ACTIVITY_DATE - TO_DATE('05-01-04', 'MM-DD-YY') ) /7 ))
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

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