Click here to Skip to main content
15,916,280 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there,
I need a select statement group by, count, average and max. This is what i have so far but i still have error. Can anyone tell me where I went wrong?
SELECT [Name], count (*) as cnt, MAX([Duration]) as maxDur, format AVG([Duration]) as avgDur FROM tbContractors groupby [Name]

Thanks in advance
Updated 1-Apr-12 16:15pm
Pradeep Shukla 1-Apr-12 22:13pm    
What is the error you got?

you are missing the Having cluase
Share this answer
I've got it by using access query..

SELECT tbContractors.Name, Avg(tbContractors.Duration) AS AvgOfDuration, Max(tbContractors.Duration) AS MaxOfDuration, Count(tbContractors.Duration) AS CountOfDuration FROM tbContractors GROUP BY tbContractors.Name

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900