lifelineamerica
Programmer
Let me explain myself as best as I can I think I need a select within a select. This is for a school bus run. I want to pull from a db all kids I am picking up at each address.
Table 1: Parents - Parent_id, Address, etc.
Table 2: Kids - Parent_id, Kid_id, ect
The following will output on each row the address and the total number of kids for that address:
The following will output the address but only the first kid id in that row:
I want to get all the kid id's for each (location) row as well.
Table 1: Parents - Parent_id, Address, etc.
Table 2: Kids - Parent_id, Kid_id, ect
The following will output on each row the address and the total number of kids for that address:
Code:
SELECT COUNT(Kids.Kid_id) as num_students, address
FROM Kids
LEFT JOIN Parents ON Parents.Parent_id=Kids.Parent_id
GROUP BY Parents.address
The following will output the address but only the first kid id in that row:
Code:
SELECT Kids.Kid_id as num_students, address
FROM Kids
LEFT JOIN Parents ON Parents.Parent_id=Kids.Parent_id
GROUP BY Parents.address
I want to get all the kid id's for each (location) row as well.