R
ryguy7272
I am trying to do something that not be possible. I posed a question a few
days ago, and received some good help, but couldn’t quite figure out how to
get a solution worked out. Anyway, I guess the best way to explain the issue
is to say that I have a table with sales data for Q3 and Q4. I have another
table with names of regions (All, East, West, etc.). I am trying to find a
way to display all regions in a query. If there are some sales reported,
they are displayed in the query results, but if there are no sales (i.e., a
value of zero), the region is not displayed in the sales results. I want to
figure out a way to display all the results, even the zeros, or nulls, or
blanks, or whatever, because this will be exported to Excel and in Excel I
need to see these zeros. Can anyone offer any suggestions as to how to
display all the results from a table when the results may be zero. By the
way, I tried a left join and that doesn’t do what I wanted to do.
SQL Here:
SELECT tblWandaRegion.SalesRegion, Sum(tblWandaRegion.Q308) AS SumOfQ308,
Sum(tblWandaRegion.Q408) AS SumOfQ408, tblWandaRegion.inventoryClass
FROM RegionTable LEFT JOIN tblWandaRegion ON RegionTable.Regions =
tblWandaRegion.SalesRegion
GROUP BY tblWandaRegion.SalesRegion, tblWandaRegion.inventoryClass
HAVING (((tblWandaRegion.SalesRegion)="All" Or
(tblWandaRegion.SalesRegion)="Alliance" Or
(tblWandaRegion.SalesRegion)="East" Or (tblWandaRegion.SalesRegion)="Inside
Sales" Or (tblWandaRegion.SalesRegion)="Unassigned" Or
(tblWandaRegion.SalesRegion)="West") AND
((tblWandaRegion.inventoryClass)="Class2"));
Thanks so much,
Ryan---
days ago, and received some good help, but couldn’t quite figure out how to
get a solution worked out. Anyway, I guess the best way to explain the issue
is to say that I have a table with sales data for Q3 and Q4. I have another
table with names of regions (All, East, West, etc.). I am trying to find a
way to display all regions in a query. If there are some sales reported,
they are displayed in the query results, but if there are no sales (i.e., a
value of zero), the region is not displayed in the sales results. I want to
figure out a way to display all the results, even the zeros, or nulls, or
blanks, or whatever, because this will be exported to Excel and in Excel I
need to see these zeros. Can anyone offer any suggestions as to how to
display all the results from a table when the results may be zero. By the
way, I tried a left join and that doesn’t do what I wanted to do.
SQL Here:
SELECT tblWandaRegion.SalesRegion, Sum(tblWandaRegion.Q308) AS SumOfQ308,
Sum(tblWandaRegion.Q408) AS SumOfQ408, tblWandaRegion.inventoryClass
FROM RegionTable LEFT JOIN tblWandaRegion ON RegionTable.Regions =
tblWandaRegion.SalesRegion
GROUP BY tblWandaRegion.SalesRegion, tblWandaRegion.inventoryClass
HAVING (((tblWandaRegion.SalesRegion)="All" Or
(tblWandaRegion.SalesRegion)="Alliance" Or
(tblWandaRegion.SalesRegion)="East" Or (tblWandaRegion.SalesRegion)="Inside
Sales" Or (tblWandaRegion.SalesRegion)="Unassigned" Or
(tblWandaRegion.SalesRegion)="West") AND
((tblWandaRegion.inventoryClass)="Class2"));
Thanks so much,
Ryan---