Maybe this is what you need --
SELECT ncm.Parent, ncm.School, ncm_child_count.CountOfChild AS
[Children
this School], Max(ncm.Grade) AS [Highest Grade]
FROM ncm INNER JOIN ncm_child_count ON (ncm.Parent =
ncm_child_count.Parent)
AND (ncm.School = ncm_child_count.School)
GROUP BY ncm.Parent, ncm.School, ncm_child_count.CountOfChild
ORDER BY ncm.Parent, ncm.School, Max(ncm.Grade) DESC;
It omits child's name.
Parent School Children this School Highest Grade
Sally Jones County High 1 11
Sally Jones St. Elizabeth 2 3
--
KARL DEWEY
Build a little - Test a little
:
Karl -
I have been playing with this and I think the problem is, I don't need
to
count how the number of students but I need to assign them a number
depending
on their grade in the same school.
So, 3 kids, all in the same family, all go to the same school. The
oldest
kid would be 1, middle kid = 2 and youngest = 3.
Does that make sense?
:
You lost me with this post.
--
KARL DEWEY
Build a little - Test a little
:
i fixed me other error. But this is not working. Do I need to
have
2
tables, 1 ncm w/ parent, school, child, grade...what does the
other
one have.
I created an identical table, 1) there is no count, 2) I get
duplicate
records.
:
How is this --
SELECT ncm.Parent, ncm.School, ncm_child_count.CountOfChild AS
[Children
this School], ncm.Child, ncm.Grade
FROM ncm INNER JOIN ncm_child_count ON (ncm.School =
ncm_child_count.School)
AND (ncm.Parent = ncm_child_count.Parent)
ORDER BY ncm.Parent, ncm.School, ncm.Grade DESC;
--
KARL DEWEY
Build a little - Test a little
:
Very cool!
This will tell me the number of students each parent has in
each
school.
Now what I need is to know who is the first, second, third,
etc.
student in
each school. The ultimate goal here is to calculate the
tuition
for each
student. There is a tuition break for each kid a family has
in
the school.
So, Student 1 gets full tuition charged, student 2 gets 2
student
discount
and so on. the grade level is what determines which student
is
first, second
and so on.
:
Try this --
SELECT ncm.Parent, ncm.School, Count(ncm.Child) AS
CountOfChild
FROM ncm
GROUP BY ncm.Parent, ncm.School;
--
KARL DEWEY
Build a little - Test a little
:
I have a list of students, parents and the school the
child
attends in a
table. I need to determine the number of students each
parent has in a
school. I would like to get this from a query.
In excel, i sort by parent, then school.
column A = Parent Name
column B = School
Column E = Number of children at the school
=IF(A1242<>A1241,1,IF(B1242<>B1241,1,E1241+1))
so, for example,
parent = Sally Jones
School = St. Elizabeth
Sally's kids, sue = grade 12, justin - grade 11, james-
grade
10
sue 1
justin 2
james 3
If Sally has kids in another school we would do another
count
for Sally's
kids at the other school