tsql - T-SQL Query not returning proper results -


i have query want capture sales parts. expecting full results parts table , if there no sales part in timeframe, want see 0 in sales column. not seeing that. getting parts had sales.

select     part,     sum(sales)     dbo.parts     left outer join     dbo.salesdata on part = part     salesdate > '2011-12-31' group     part order     part 

what doing wrong?

i believe because where clause removing parts don't have sales because won't have salesdate.

try:-

select     part,     sum(sales)     dbo.parts     left outer join     dbo.salesdata on part = part     , salesdate > '2011-12-31' group     part order     part 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -