Query Help

2002-02-20 Thread Web boy

Hello I have a query that goes through and gets the
data out of three tables without a problems.   Now the
task at hand is to compair that out put against three
identiacal tables not displaying any duplicate date.


Tables:

a
a.aocode , a.CaseNo , a.CaseName

b.
b.ao_code , b.initials

c
c.CaseNo, c.Name

Then the new three tables have the same structure
except they are named a_new, b_new, c_new.

The query that I am using to pull the data out of the
first table is as follows:

  Select distinct a.CaseNo,
a.CaseName, b.initials,  c.Name,
   
   from a

   left join b on a.aocode=b.ao_code
   left join c on a.CaseNo=c.CaseNo 
  where b.initials ='XXX'
For this example lets say that I have a where clause
in there also that would get passed as a variable from
another script.

Now how in the world to I take run this query against
both sets of tables and then combine the data and
bring back a result?

Thanks---

=
Want to know when a band is playing or want to see what bands are playing at your 
favorite bar go to 
www.buffalogigs.com

__
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Query Help

2002-02-20 Thread Web boy

Is there another way as I do not have that version of
MYSQL installed on my server?

THanks-
KCK
--- Tod Harter [EMAIL PROTECTED] wrote:
 On Wednesday 20 February 2002 09:20, Web boy wrote:
 
 You want to use UNION. If I remember correctly its a
 fairly new feature for 
 MySQL, but its a standard SQL thing.  From the
 manual:
 
 SELECT ...
 UNION [ALL]
 SELECT ...
   [UNION
SELECT ...]
 
 UNION is implemented in MySQL 4.0.0.
 
 UNION is used to combine the result from many SELECT
 statements into one 
 result set.
 
 The SELECT commands are normal select commands, but
 with the following 
 restrictions:
 
 * Only the last SELECT command can have INTO
 OUTFILE.
 * Only the last SELECT command can have ORDER
 BY.
 
 If you don't use the keyword ALL for the UNION, all
 returned rows will be 
 unique, like if you had done a DISTINCT for the
 total result set. If you 
 specify ALL, then you will get all matching rows
 from all the used SELECT 
 statements.
 
 
 
  Now how in the world to I take run this query
 against
  both sets of tables and then combine the data and
  bring back a result?
 
  Thanks---
 
  =
  Want to know when a band is playing or want to see
 what bands are playing
  at your favorite bar go to www.buffalogigs.com
 


=
Want to know when a band is playing or want to see what bands are playing at your 
favorite bar go to 
www.buffalogigs.com

__
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php