>>Thanks Craig, but in this way SELECT returnm me the same number of records as without the Group By Clause, before with Set Enginebehavior 70 and only writing codpai in the Group By it gives me 19, and writing what you told me it gives me 1410 Records.
>>Thanks for your time
>>Luis Navas
>>>The GROUP BY must include all the fields in the SELECT that are not aggregate fields (SUM, AVG, etc).
>>>
>>>GROUP BY Codpai, Codven, Valpedmn, Fecped, Nompai, Nomven
>>>
>
>That's because the values of Codven, Valpedmn, Fecped, Nompai and Nomven are not all the same for each value of Codpai. With the old way, you had no guarantee of what values would be in these other fields. The old way also was not ANSI SQL compliant.
Thanks, but what if want to group on Codven and I donsen't care if the other values are the same?
Luis
I never forget a face, but in your case I will make an exception :-)