Changing the Group By Level to first 3 letters in Access Queries

D

Dazed

Hi, I need to change the Group By level in my Access Query so that it
will group my Postal Code/Zip Codes by the first 3 characters. I am
guessing that I am going to need to change the SQL settings. If you
could give it to me as exact as possible that would be great.(I am not
a programmer, so the language throws me off) Here is what my current
Syntax looks like. What would I need to change?

SELECT [customer table].[Zip/Postal Code], Sum([order table].SubTotal)
AS SumOfSubTotal, Count([customer table].[Cust#]) AS [CountOfCust#],
Avg([order table].SubTotal) AS AvgOfSubTotal
FROM [customer table] INNER JOIN [order table] ON [customer
table].[Cust#] = [order table].[Sold to Customer]
GROUP BY [customer table].[Zip/Postal Code];

Thanks
 
D

Duane Hookom

SELECT Left([customer table].[Zip/Postal Code],3 as Zip, Sum([order
table].SubTotal)
AS SumOfSubTotal, Count([customer table].[Cust#]) AS [CountOfCust#],
Avg([order table].SubTotal) AS AvgOfSubTotal
FROM [customer table] INNER JOIN [order table] ON [customer
table].[Cust#] = [order table].[Sold to Customer]
GROUP BY Left([customer table].[Zip/Postal Code],3);
 
D

Dazed

Duane said:
SELECT Left([customer table].[Zip/Postal Code],3 as Zip, Sum([order
table].SubTotal)
AS SumOfSubTotal, Count([customer table].[Cust#]) AS [CountOfCust#],
Avg([order table].SubTotal) AS AvgOfSubTotal
FROM [customer table] INNER JOIN [order table] ON [customer
table].[Cust#] = [order table].[Sold to Customer]
GROUP BY Left([customer table].[Zip/Postal Code],3);

--
Duane Hookom
MS Access MVP



Dazed said:
Hi, I need to change the Group By level in my Access Query so that it
will group my Postal Code/Zip Codes by the first 3 characters. I am
guessing that I am going to need to change the SQL settings. If you
could give it to me as exact as possible that would be great.(I am not
a programmer, so the language throws me off) Here is what my current
Syntax looks like. What would I need to change?

SELECT [customer table].[Zip/Postal Code], Sum([order table].SubTotal)
AS SumOfSubTotal, Count([customer table].[Cust#]) AS [CountOfCust#],
Avg([order table].SubTotal) AS AvgOfSubTotal
FROM [customer table] INNER JOIN [order table] ON [customer
table].[Cust#] = [order table].[Sold to Customer]
GROUP BY [customer table].[Zip/Postal Code];

Thanks
Thank you sooo much!!!. You guys have no idea how highly I think of
you!. Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top