What error message are you getting?

Also your column order is different in the two queries which will cause problems.  Make them the same order (email, firstname, lastname) and see if that works.

Sam

>>> [EMAIL PROTECTED] 12/09/03 11:39AM >>>
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]

Reply via email to