View Full Version : Simple access situation


Xi0N
08-04-2009, 12:21 AM
Im quite new to the use of sql, and i have this problem right now:

I have two tables:

Schools
Students

Each row in the students table has a "school_code" field that corresponds with a code of one school in the Schools tables.


I have to count how many students are there in each school: Basically, i should do a new query with the entire table "Schools" and add one more field with the number of students in each school......

Can anyone tell me how can i do this? For me is quite difficult to guess it right now, and i have a bit of an urgency with this.


thanks!

DCrake
08-04-2009, 12:34 AM
Not homework again??

Use a query to group by school code and count students.

Xi0N
08-04-2009, 01:18 AM
Sorry, im not requesting anyone to do any homework for me: This is an access help forum, as i can see, and i am only asking if anyone, by his own will, can solve this problem for me, so i can learn as well....
I am learning sql slowly, i cannot dedicate all the day exclusively to it, and i came across this problem, which is not really common to happen......
I appreciate your help, but, can you be more specific on how to do this? I dont usually use access in this level, and my sql knowledgements are too basic......

I mean: I knew i have to do that, but all the left join and group things are a bit difficult for me still.....

Thanks!

DCrake
08-04-2009, 01:37 AM
Create a new query and select the Students table.

Drag down the field that holds the school code into the bottom pane

Go to the tool bar and click on the Sigma button

This will create a grouping query

Next go to the first empty column and on the top line type in Cnt:1 and change the Group By to Count

Finally click the Run button (!)

This will count the number of students by school code.

David

Xi0N
08-04-2009, 02:39 AM
Thanks you very much: For your help, and for understanding me :)