I have the following query:
'FANO1' = SUM(Case When year(datalc)=2010 Then fc.ecred Else 0 End),
'Dif' = SUM(Case When year(datalc)=2010 Then fc.ecred Else 0 End)-SUM(Case When year(datalc)=2009 Then fc.ecred Else 0 End)
fc(nolock) left join fo on fc.fostamp=fo.fostamp
fc.fano1 <> 0
This query returns an error that fano1 isn't found. It works flawlessly without the WHERE clause. But i need it to ensure that i don't get lines with suppliers that didn't sell...
Is there any other way i can rule out the rows where fano1 is equal to 0?
fc.no => int
fc.nome => varchar
fc.datalc => datetime
fc.ecred => float