max(case when datediff(YY,max(birth_date1),getdate()) > 18 then dep_first_name1 else 0 end) maj_dep_first_name
When I run my procedure with the above statement I get teh error: Cannot perform an aggregate function on an expression containing an aggregate or a subquery.
Any help is appreciated. Thanks RTSFO
you have a max() within another max()
try removing the outer max()
if does not work, please post your full query
answered Dec 04 '09 at 11:29 PM