On Sep 2, 2007, at 7:58 PM, Ricardo Aráoz wrote:

> select EmployeeId, EmpName, sum(salary) ;
> from Employee ;
> group by EmployeeId
>
> This would have sense but it is easily done with :

        To a human, perhaps, but to a database engine, there is no  
constraint that the ID and name be a 1:1 pair.

> select EmployeeId, max(EmpName) as 'EmpName', sum(salary) ;
> from Employee ;
> group by EmployeeId

        And why is is that any simpler (or better, or cleaner, or...) than:

select EmployeeId, EmpName, sum(salary) ;
from Employee ;
group by EmployeeId, EmpName

        If I inherited code that used max() of a name, red flags would be  
raised in my mind as to the original coder's sanity.  ;-)


-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com




_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to