crazy inner join

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need some help with some sql I can't seem to get the syntax right. I've tried several but to no avail the one below gets me the
closest but I can't get the guardians records pulled.

SELECT SUM(tuition)
FROM child INNER JOIN guardian ON guardian.ID = child.child_ID

I would like the results to show the records from the guardian table as well

tables:
GUARDIAN
fields:
ID
guardian1_first
guardian1_last

CHILD
fields:
ID
child_ID
first_name
last_name
tuition

relationship: guardian.ID = child.child_ID

results should show:

guardian1_first, guardian1_last, and the SUM(child.tuition) for all children where the child_ID is equal to the ID of guardian
listed

any help would be much appreciated, I've been driving myself mad with this
 
I need some help with some sql I can't seem to get the syntax right. I've
tried several but to no avail the one below gets me the
closest but I can't get the guardians records pulled.

SELECT SUM(tuition)
FROM child INNER JOIN guardian ON guardian.ID = child.child_ID

I would like the results to show the records from the guardian table as well

tables:
GUARDIAN
fields:
ID
guardian1_first
guardian1_last

CHILD
fields:
ID
child_ID
first_name
last_name
tuition

relationship: guardian.ID = child.child_ID

results should show:

guardian1_first, guardian1_last, and the SUM(child.tuition) for all
children where the child_ID is equal to the ID of guardian
listed

any help would be much appreciated, I've been driving myself mad with this

SELECT guardian1_first, guardian1_last, SUM(tuition)
FROM child INNER JOIN guardian ON guardian.ID = child.child_ID
GROUP BY guardian1_first, guardian1_last
 
You need the GROUP BY clause like:

SELECT G.[guardian1_first], G.[guardian1_last], SUM(C.tuition)
FROM [guardian] As G INNER JOIN [child] As C
ON G.[ID] = C.[child_ID]
GROUP BY G.[ID]


--
HTH
Van T. Dinh
MVP (Access)


I need some help with some sql I can't seem to get the syntax right. I've
tried several but to no avail the one below gets me the
closest but I can't get the guardians records pulled.

SELECT SUM(tuition)
FROM child INNER JOIN guardian ON guardian.ID = child.child_ID

I would like the results to show the records from the guardian table as well

tables:
GUARDIAN
fields:
ID
guardian1_first
guardian1_last

CHILD
fields:
ID
child_ID
first_name
last_name
tuition

relationship: guardian.ID = child.child_ID

results should show:

guardian1_first, guardian1_last, and the SUM(child.tuition) for all
children where the child_ID is equal to the ID of guardian
 
Back
Top