Group functions of outer query inside inner query

Posted by superdario on Stack Overflow See other posts from Stack Overflow or by superdario
Published on 2010-04-04T13:04:57Z Indexed on 2010/04/04 13:13 UTC
Read the original article Hit count: 305

Filed under:
|

Hello,

I'm using Oracle. I'm trying to compose something like this:

SELECT trans_type,
(SELECT parameter_value FROM transaction_details WHERE id = MAX(t.trans_id))
FROM
(SELECT trans_id, trans_type FROM transactions) t
GROUP BY trans_type

So, I am trying to use a result of grouping inside an inner query. But I am getting the error that I cannot use a group function inside the inner query:

ORA-00934: group function is not allowed here

Can you offer an alternative other than resorting to another outer query?

© Stack Overflow or respective owner

Related posts about sql

Related posts about Oracle