Re:"I've isolated the bug to a database query"
by ckuehne on Wednesday November 09, 2011 @12:27PM
(#3216409)
What he (probably) means is that the following query returns the same result as your query:
select
sp.Name,
sum(s.Amount) as TotalSales
from
Sales s
RIGHT join SalesPerson sp on
sp.SalesPersonKey = s.SalesPersonKey
group by
sp.Name
order by
TotalSales desc
EDIT: Formatting.
Re:"I've isolated the bug to a database query"
by jtheory on Thursday November 10, 2011 @07:50AM
(#3219862)
That's what was meant, I assume, but it's misguided. Right joins don't create a "code smell" for technical reasons, but for practical reasons. Because left joins are the standard approach, if you're using a non-standard approach to a common problem you'd better have a damned good reason (because you're just confusing maintenance programmers... and thus causing errors... with no justification, otherwise).
Left joins (and full outer joins) are plenty useful and I use them almost daily. Care to explain what you mean?