List:General Discussion« Previous MessageNext Message »
From:SGreen Date:August 9 2004 4:37pm
Subject:Re: Selecting data from 2 tables.
View as plain text  
I think so:

CREATE TEMPORARY TABLE tmpList
SELECT DISTINCT magazine
FROM pages;

INSERT tmpList
SELECT DISTINCT magazine
FROM pdflog;

SELECT DISTINCT magazine FROM tmpList;

DROP TABLE tmpList;

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Ed Curtis <ed@stripped> wrote on 08/09/2004 12:33:28 PM:

> 
> > I think a quick way to write this query would be
> > (http://dev.mysql.com/doc/mysql/en/UNION.html):
> >
> > ( SELECT magazine FROM pages )
> > UNION DISTINCT
> > ( SELECT magazine FROM pdflog )
> > ORDER BY magazine;
> 
>  Thanks for all the help on this one. I just also realized that the 
server
> I'm working with has version 3.23.x of MySQL. My only other option now 
is
> to create a temp table with distinct data from both tables, is it not?
> 
> Ed
> 
> 

Thread
Selecting data from 2 tables.Ed Curtis9 Aug
  • Re: Selecting data from 2 tables.Martijn Tonies9 Aug
    • Re: Selecting data from 2 tables.Ed Curtis9 Aug
    • Re: Selecting data from 2 tables.SGreen9 Aug
      • Re: Selecting data from 2 tables.Ed Curtis9 Aug
      • Re: Selecting data from 2 tables.Ed Curtis9 Aug
        • Re: Selecting data from 2 tables.SGreen9 Aug
          • Re: Selecting data from 2 tables.Ed Curtis9 Aug
            • Re: Selecting data from 2 tables.SGreen9 Aug
      • Re: Selecting data from 2 tables.Martijn Tonies9 Aug