Hi everybody,
I am being desperate from one of my queries, any help is really appreciated.
The problem is following:
Consider a table called 'NAMES' with a name and gender columns. It will be filled with three male names, so gender column would be always 'male'. Now I have following query:
SELECT *
FROM (SELECT COUNT(*), GENDER
FROM NAMES
GROUP BY GENDER)
WHERE SomeFunction(GENDER) = 1;
Now if I put logging into function "SomeFunction", I see it is called three times. Why?
The inner select should return only one row, so I would suppose that the function should be called only once.
How should I rewrite the select statement to call "SomeFunction" only once as expected?
Thanks for help, Dan