It looks right to me.  Are you sure that the pl_companies query is
supposed to return a record?  If it does, and it is the same as a record
in the first query, it will not show because union eliminates duplicate
records.  Try isolating the second query to ensure that it does return a
rowset.

Matthew Small
IT Supervisor
Showstopper National Dance Competitions
3660 Old Kings Hwy 
Murrells Inlet, SC 29576
843-357-1847
http://www.showstopperonline.com

-----Original Message-----
From: Mark Leder [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, January 07, 2003 10:18 AM
To: CF-Talk
Subject: SQL Union Statement

Hi All,

Am I using the UNION statement correctly to join two different queries
based
on two different tables in the same database?  I can't seem to get the
data
from the pl_companies table to return a record.

Thanks.
==============================
<cfquery name="qSponsor1" datasource=#REQUEST.dsn1#>
                SELECT co_name, sponsor
                FROM tCultivarCompanies
                WHERE sponsor = 1
        UNION
                SELECT co_name, sponsor
                FROM pl_companies 
                WHERE sponsor = 1       
        ORDER BY co_name
</cfquery>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to