Home » SQL & PL/SQL » SQL & PL/SQL » group function is not allowed here
group function is not allowed here [message #143322] Wed, 19 October 2005 21:36 Go to next message
janesddl
Messages: 3
Registered: October 2005
Junior Member
do anyone hav any idea how to reconstruct the select statement as i'm hitting the error ORA-00934: group function is not allowed here. I have checked the oracle error message, suggesting me to remove the max and including the function in a subquery or having clause. But i've no idea where to start it.
Quote:

SELECT lm.CustID,
ld.dname,
MAX(lm.Created_date),
(SELECT lm2.App
FROM Log_master lm2
WHERE (lm2.Created_date = MAX(lm.Created_date) AND
lm2.CustID = lm.CustID)
AND rownum <= 1)
FROM Log_master lm
INNER JOIN Log_details ld ON lm.CustID = ld.winID
WHERE lm.Created_date >= systimestamp
AND lm.Level_check = 1
GROUP BY lm.CustID,
ld.dname
ORDER BY ld.dname


TQ
Re: group function is not allowed here [message #143332 is a reply to message #143322] Wed, 19 October 2005 23:51 Go to previous messageGo to next message
kiran
Messages: 503
Registered: July 2000
Senior Member
Quote:

(SELECT lm2.App
FROM Log_master lm2
WHERE (lm2.Created_date = MAX(lm.Created_date) AND
lm2.CustID = lm.CustID)


You are not suppose to use group functions in where cluase.Thats what is causing the error.

If possible post your tables definition and desired output , that will help us.

--Kiran.

Re: group function is not allowed here [message #143392 is a reply to message #143322] Thu, 20 October 2005 05:03 Go to previous message
venkatraghavan
Messages: 83
Registered: October 2005
Location: chennai
Member
instead of 'where clause', you have to use 'having'.....
try and send reply
Previous Topic: How can this srored proc be written?
Next Topic: 2 Problems
Goto Forum:
  


Current Time: Sun Aug 24 13:30:49 CDT 2025