Your both right, thanks.
Thanks, Mark
-----Original Message-----
From: Adrian Lynch [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 09, 2003 11:55 AM
To: CF-Talk
Subject: RE: SQL UNION Trouble
Try aliasing your columns. I think you need to have the same column names
and number of columns for the union to work. If one query has an extra
column as yours does, alias the other query and set it to NULL.
SELECT col1, col2, col3, col5 = NULL
FROM table1
UNION
SELECT col1, col2, col4 AS 'col3', col5
FROM table2
That's a rough guess though, it's been a while since I've done this.
Ade
-----Original Message-----
From: Mark Leder [mailto:[EMAIL PROTECTED]
Sent: 09 December 2003 16:40
To: CF-Talk
Subject: SQL UNION Trouble
In the following query I want the email addresses from two different tables
to be grouped together (for sending in CFMail), can't get it to work, what
am I missing? (BTW: the individual queries work just not as a UNION)
<cfquery name="qMailMessage" datasource="#REQUEST.dsnSQL#"
username="#REQUEST.dsnUID#" password="#REQUEST.dsnPWD#">
SELECT L.email, L.firstname, L.lastname
FROM #REQUEST.prefix#_Members_List L
WHERE L.email IS NOT NULL
UNION
SELECT A.assistantfirstname, A.assistantLastName,
A.assistantEmail AS A.email
FROM #REQUEST.prefix#_Members_AssistantInfo A
WHERE A.email IS NOT NULL
ORDER BY email
</cfquery>
Thanks, Mark
_____
_____
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
- SQL UNION Trouble Mark Leder
- Re: SQL UNION Trouble Nick de Voil
- cfencrypt alternative that also works in visual ... ezine
- Quotation marks in textfields Brook Davies
- Re: Quotation marks in textfields Deanna Schneider
- RE: SQL UNION Trouble Adrian Lynch
- Re: SQL UNION Trouble Mark Leder
- Re: SQL UNION Trouble Sam Farmer