For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > August 2004 > Re: select distinct from two tables









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: select distinct from two tables
Barand

2004-08-18, 3:57 pm

Don't know if UNION supported so assuming it isn't you could
get them into 1 temporary table first

--------
CREATE TEMPORARY TABLE temp SELECT country, code FROM table1
--------

Add table2 records
--------
INSERT INTO temp SELECT country, code FROM table2
--------

then

--------
SELECT DISTINCT country, code FROM temp
--------

hth

Barand

http://members.aol.com/barryaandrew...agridguide.html easy
data tables - and more

----------------------------------------
The post originated from PHP Freaks:
----------------------------------------
http://www.phpfreaks.com
http://www.phpfreaks.com/forums


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com