Re: Selecting data from 2 tables.

2004-08-09 Thread SGreen
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 <[EMAIL PROTECTED]> wro

Re: Selecting data from 2 tables.

2004-08-09 Thread Ed Curtis
> 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 wi

Re: Selecting data from 2 tables.

2004-08-09 Thread Martijn Tonies
That depends on your definition of a "join"... I don't call it a join without a join condition. It gives you tableA * tableB results - that's a carthesian product. Hardly a normal join. With regards, Martijn Tonies Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL Serve

Re: Selecting data from 2 tables.

2004-08-09 Thread SGreen
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; Shawn Green Database Administrator Unimin Corporation - Spruce Pine Ed Curtis <[EMAIL PROTECTED]> wro

Re: Selecting data from 2 tables.

2004-08-09 Thread Ed Curtis
> What he is really missing is the WHERE clause that matches something from > pages with something from pdflogWithout it he is requesting a > Cartesian product of his tables (every combination of each row from both > tables). > > I prefer to define my JOINS *explicitly*. It makes it harde

Re: Selecting data from 2 tables.

2004-08-09 Thread Ed Curtis
On Mon, 9 Aug 2004 [EMAIL PROTECTED] wrote: > He does have a join. He has an *implied* INNER JOIN > (http://dev.mysql.com/doc/mysql/en/JOIN.html): > > FROM pages, pdflog > > What he is really missing is the WHERE clause that matches something from > pages with something from pdflogWithout

Re: Selecting data from 2 tables.

2004-08-09 Thread SGreen
He does have a join. He has an *implied* INNER JOIN (http://dev.mysql.com/doc/mysql/en/JOIN.html): FROM pages, pdflog What he is really missing is the WHERE clause that matches something from pages with something from pdflogWithout it he is requesting a Cartesian product of his tables

Re: Selecting data from 2 tables.

2004-08-09 Thread Ed Curtis
> > Feel stupid again ;-) > > Where's your JOIN? > > With regards, > > Martijn Tonies Thanks, that makes me feel better :) Ed -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: Selecting data from 2 tables.

2004-08-09 Thread Martijn Tonies
Hi, > God, I feel real stupid this morning and know I should know this. I have > 2 tables in the same database and I'm trying to select distinct data from > a row with the same name in each table. > > SELECT DISTINCT company FROM pages, pdflog ORDER BY company ASC > > I'm missing something I'm sur