I have a statement like so:
SELECT f.column1, 0.9*sum(s.column2) FROM first f, second s WHERE f.colum1 = f.column1*0.9*sum(s.colum2)
Basically what I want to do is multiply the value from the 'first' table in the column1, by 0.9*sum(s.colum2) i.e the sum of the values in column2 of the second table multiplied by 0.9.
I tested the sum*0.9 part on its own and it works but it doesn't work after the WHERE condition. Could anyone tell me the proper way to do this? Right now the error I'm getting is:
could not prepare statement (1 misuse of aggregate: sum())