List:General Discussion« Previous MessageNext Message »
From:Doug Ledbetter Date:April 9 1999 4:39pm
Subject:Re: SQL w/ multiple tables question
View as plain text  
At 12:26 PM 4/9/99 -0400, you wrote:

>At the very least we need to know what field(s) link the tables.
>Normally I'd expect this query to look like:
>
>select lname,fname,username from students,staff,faculty 
>where unlisted='f' AND students.common_field = staff.common_field AND
>staff.common_field = faculity.common_field
>order by lname, fname;


That's the problem.  I don't want to link the tables.  That's why a join
won't work.  I want ALL records from ALL the tables involved.  There is no
special link between tables.  I think I need a UNION among the tables, but
that's not supported yet!

Each table has username,fname,lname (and other) fields.  I want the output
to contain EVERY record for EVERY table involved.  I'd prefer to only
select a few fields, but I could select all fields and just make use of the
data I need in my Perl script.

The goal here is to create an email search webpage.  I have a database with
these tables for different categories of users (staff, faculty, students,
etc.).  I want to do a search through all of them for the output to the
webpage.

The more I research this, the more I think I'm going to have to make
individual selects, then combine my lists into one large list, and sort it
before generating the output.  At least until MySQL supports UNIONs.

Any thoughts?

-dougl

-----------------------------------------------------------------------------
 Doug Ledbetter        --       Webmaster       --       "The Mad Scientist"
 MidAmerica Nazarene University 2030 East College Way, Olathe, KS 66062-1899
 dougl@stripped           (913)782-3750 x205              http://www.mnu.edu/

 "Whoever shall introduce into public affairs the principles of primitive
Christianity will change the face of the world."  --Benjamin Franklin 1778"
----------------------------------------------------------------------------
Thread
SQL w/ multiple tables questionDoug Ledbetter9 Apr
Re: SQL w/ multiple tables questionDoug Ledbetter9 Apr
RE: SQL w/ multiple tables questionDaniel Gardner9 Apr
  • Re: SQL w/ multiple tables questionThimble Smith9 Apr