SunQuest
           Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old April 26th, 2004, 12:53 PM
s_c_gardner s_c_gardner is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: NYC
Posts: 8 s_c_gardner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Group by problem

I have a somewhat complex query that's giving me the old "Not a Group By Expression" error:

Code:
SELECT spr.rep_id, tri.inst_mnemonic,
tr.trade_date, tr.acct_id, tr.sec_key, tr.buy_sell, tr.price,  tr.cusip, sum(tr.quantity), sum(tr.otc_credits), sum(tr.commission) FROM spr, sptk, tr, ac, tri, rsrt
WHERE	spr.split_id  = sptk.split_id AND	tr.acct_id = sptk.acct_id AND	tr.sec_key = sptk.sec_key AND
tr.buy_sell = sptk.buy_sell  AND tr.price = sptk.price AND tr.quantity = sptk.quantity AND tr.otc_credits = sptk.otc_credits  AND tr.trade_date = sptk.trade_date AND tr.reference = sptk.reference AND NOT tr.status_flag = 'D' 
AND ac.acct_id = tr.acct_id AND	tri.inst_id = ac.inst_id AND ( tr.otc_credits > 0 OR tr.commission > 0 )
AND rsrt.rep_id = spr.rep_id AND tr.trade_date BETWEEN '01-Jan-04' AND '30-Apr-04'
group by 1, 2, 3, 4, 5, 6, 7, 8;


I'm not sure why, given I'm using all the columns in the select. Anyone have any ideas?

Reply With Quote
  #2  
Old April 26th, 2004, 01:30 PM
shafique shafique is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Canada
Posts: 305 shafique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 20 sec
Reputation Power: 5
I don't think so you can use either column alias name or column position number in GROUP BY clause use the exact column name.


Regards,

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Group by problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway