Help for building a statistical query, thanks a lot!

Joined
Jul 5, 2005
Messages
22
Reaction score
0
Hi,

I want build a SQL query to generate statistical result from a table(students) in MS Access as below:

Student# City Amount
001 toronto 1000
002 ottawa 3000
003 toronto 4000
004 ottawa 8000
005 montreal 11000
006 vancouver 15000

i build a query but does not work:

SELECT Amount AS ["0~5000"], COUNT(1) AS ["NUMBER OF STUDENTS"]
FROM students
WHERE amount > -5000

UNION SELECT amount AS ["5000~10000"], COUNT(1) AS ["NUMBER OF STUDENTS"]
FROM students
WHERE amount < -5000 AND amount > -10000;

i want to get result of how many students who have loan amount is between 0-5000, 5000-10000, 10000-15000?

output:

Amount***************** Number of students
0-5000***************** 3
5000-10000***************** 1
10000-15000***************** 2


how to do that?

Thanks a lot.

Peter
 
Last edited:

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