[thelist] SQL help - I think JOINing is required

Marc Seyon seyon at delime.com
Sun Nov 11 21:26:17 CST 2001

At 11/11/2001 10:17 PM, you wrote:
>On Nov 11, Marc Seyon had something to say about [thelist] SQL help - I...
> >In each of the latter three, the entry is referenced by the same unique ID
> >stored in General Info. So, for any given record, GenInfo.ID = Contact.ID =
> >Job.ID = Education.ID
> >
> >In a nutshell, I'm trying to select everything from each table for an
> >entry, based on the Name. I've got as far as SELECT TableName.ColumnName
> >(for each item) FROM List of tables. Not sure how the WHERE clause should
> >be constructed.
>*IF* I understand your setup right, you want something like this:
>SELECT g.foo, c.bar, j.silly, e.string
>FROM GeneralInfo g, Contact c, Job j, Education e
>AND g.ID=j.GenID
>AND g.ID=e.GenID
>AND g.ID=[the id]
>Now, since these are in different tables, you really don't have a 1-1
>relationship here. IOW, an general info record can have many contact, job,
>and education records. If that's the case, the above ain't going to work
>for you and it get's a little nastier.

Matt, these tables all will have 1-1 relationships. However there will be 
an additional table in the future which may have multiple records for a 
single ID.

How much nastier is "a little"?


More information about the thelist mailing list