Grouping data/Aggregate functions

M

MsDYJ

I'm working with data that deals with deliveries. Items are shipped by
different carriers each week. The carriers always remain the same but the
data does not..so 1 carrier can have lots of data. I'm wanting to get an
average of the amount of days it takes to them to get something where it
needs to go. How in the query can I get each carrier grouped with an average
of the days. Right now all I am getting is this...
Carrier Days
A 5
B 10
C 15
A 10
B 15
C 20

What I want is this...
Carrier Days(Averaged)
A 7.5
B 12.5
C 17.5

Thanks,
Diana
 
K

KARL DEWEY

SELECT Carrier, Avg([Days]) AS Delivery_Average
FROM YourTable
GROUP BY Carrier;
 
M

Marshall Barton

MsDYJ said:
I'm working with data that deals with deliveries. Items are shipped by
different carriers each week. The carriers always remain the same but the
data does not..so 1 carrier can have lots of data. I'm wanting to get an
average of the amount of days it takes to them to get something where it
needs to go. How in the query can I get each carrier grouped with an average
of the days. Right now all I am getting is this...
Carrier Days
A 5
B 10
C 15
A 10
B 15
C 20

What I want is this...
Carrier Days(Averaged)
A 7.5
B 12.5
C 17.5

SELECT Carrier, Avg(Days)
FROM table
GROUP BY Carrier
 

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