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 sure because it
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 sure
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]
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
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 it he
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 harder to
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]
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 Server.
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
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]
10 matches
Mail list logo