I'm trying to combine the GROUP BY
function with a MAX in oracle. I read a lot of docs around, try to figure out how to format my request by Oracle always returns:
ORA-00979: "not a group by expression"
Here is my request:
SELECT A.T_ID, B.T, MAX(A.V)
FROM bdd.LOG A, bdd.T_B B
WHERE B.T_ID = A.T_ID
GROUP BY A.T_ID
HAVING MAX(A.V) < '1.00';
Any tips ?
EDIT It seems to got some tricky part with the datatype of my fields.
T_ID
isVARCHAR2
A.V
isVARCHAR2
B.T
isCLOB
'1.00'
is a string it is not a number - (1.00
or1
) is a number.group by
on aCLOB
column - why do you need that at all? If you need a max() thenCLOB
doesn't sound like the right data type. And if you store numbers inLOG.V
then why don't you define it as anumber
?. It's a really bad design to store numbers invarchar
columns.