I am trying to write a query on which I do not want to have Cartesian products. I was going to use the First function, because some Type_Codes have several descriptions, and I do not want to multiply my dollars.
Select Sum(A.Dollar) as Dollars, A.Type_Code, First(B.Type_Description) as FstTypeDescr From Totals A, TypDesc B Where A.Type_Code = B.Type_Code Group by A.Type_Code
I just want to get ANY of the descriptions for this code (I don't care which one). When I try to use FIRST, I get the following error:
[IBM][CLI Driver][DB2/AIX64] SQL0440N No authorized routine named "FIRST" of type "FUNCTION"
Is there any other way to do this?
source share