Return one row result from two tables with one to many

H

Hector

I have two tables one is a family table and the other is table1. The family
table list the primary key FamID, Guardian name and address information.
Table1 list the student id, name and FamID. How can I return a single row
with the family table info and all the students linked to that family id so
that I can export it?
the result that I'm looking for in one row would be something like the
following:
FamID, GuardLast, GuardFirst, Address, Apt#, City, st, Zip,
StudID#1,Last#1,First#1,StudID#2,Last#2,First#2,StudID#3,Last#3,First#3,StudID#4,Last#4,First#4,StudID#5,Last#5,First#5,StudID#6,Last#6,First#6,StudID#7,Last#7,First#7,StudID#8,Last#8,First#8
I did a left join but I'm getting several rows for a family with multiple
children.
Here is what I tried that gave me several rows:

SELECT Table1.FamID, Family.GuardLast, Family.GuardFirst, Family.Address,
Family.[Apt#], Family.City, Family.st, Family.Zip, Table1.StdID,
Table1.StdLast, Table1.StdFirst
FROM Table1 LEFT JOIN Family ON Table1.FamID = Family.FamID;
 

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