When I want to merge data between to SQL SELECT statements, I do the
following:

/*
    Create the temporary table to match the data types
    of the SELECT statements below
*/

CREATE TABLE #TEMP_TABLE (
    FIELD_A int,
    FIELD_B varchar(50)
)

/*
    Assuming that FIELD_1 & FIELD_3 are of type int
    and FIELD_2 & FIELD_4 are of type varchar(50)
*/

INSERT #TEMP_TABLE(FIELD_A,FIELD_B)
    SELECT FIELD_1, FIELD_2
    FROM TABLE_1
    WHERE CONDITION

INSERT #TEMP_TABLE(FIELD_A,FIELD_B)
    SELECT FIELD_3, FIELD_4
    FROM TABLE_2
    WHERE CONDITION

/*
    Now we can query the two merged queries with
    any condition and/or order
*/


SELECT FIELD_A, FIELD_B
FROM TEMP_TABLE
ORDER BY FIELD_A

DROP TABLE #TEMP_TABLE


Hope this might help!

- SVV

----- Original Message -----
From: "Ken Monroe" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, August 01, 2001 7:00 AM
Subject: Concatenate 2 Queries


Hello!

Is there a way to combine (concatenate) 2 different queries *without* using
the QueryNew, QueryAddRow, QuerySetCell stuff?  Something like
QueryCat(Query1, Query2). ??

Thx
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to