Home » SQL & PL/SQL » SQL & PL/SQL » invalid group by query
invalid group by query [message #440143] Thu, 21 January 2010 05:29 Go to next message
pyscho
Messages: 134
Registered: December 2009
Senior Member
SELECT SUM(AMT) FROM CASH_TRANS GROUP BY ACCOUNT_ID || '~' || TXN_CCY


The above works, but when i try and get the account_id too it fails saying it isnt valid grouping

SELECT ACCOUNT_ID, SUM(AMT) FROM CASH_TRANS GROUP BY ACCOUNT_ID || '~' || TXN_CCY


[EDITED by LF: [coce] tags substituted with [code] ones]

[Updated on: Thu, 21 January 2010 06:40] by Moderator

Report message to a moderator

Re: invalid group by query [message #440147 is a reply to message #440143] Thu, 21 January 2010 05:35 Go to previous message
Michel Cadot
Messages: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Yes, you group on "ACCOUNT_ID || '~' || TXN_CCY" so ACCOUNT_ID alone is not a group by expression.
Group on both columns instead (as we already told several times in previous topics).

Regards
Michel

[Updated on: Thu, 21 January 2010 05:35]

Report message to a moderator

Previous Topic: Problem with varray type out parameter (splitted from "xmltype conversion" topic)
Next Topic: Dependent objects
Goto Forum:
  


Current Time: Sat Dec 07 05:10:44 CST 2024