You can use the UNION operator to merge two queries together.

-----------------------------------
Regards,

Darryl Lyons
Senior Systems Developer
Fuzion: http://www.fuzion.com.au

Email : [EMAIL PROTECTED]
Phone : (07) 3620 1000
Fax   : (07) 3620 1001              
Technical Support : 1300 888 480

'merging business + technology'


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 20, 2001 1:57 PM
To: CF-Talk
Subject: Re: How can I merge the results of two queries. (tds)



You can do one more thing as they say there are many ways to skin a cat
convert both the queries into list or array and then merge them and make
them in to one single array or list and then use the combined one for your
manipulation

hope it works

----------------------------------------------------------------------------
----------------------------------------------------------------------------
-------------------------------------------------------

 The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material.  Any review, retransmission,  dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.   If you received
this in error,  please contact the sender and delete the material from any
computer.
-- Phoenix Global Solutions (India) Pvt Ltd., www.pgsolutions.com
----------------------------------------------------------------------------
----------------------------------------------------------------------------
---------------------------------------------------------


 

                    Troy Simpson

                    <Troy_Simpson        To:     CF-Talk
<[EMAIL PROTECTED]>                               
                    @ncsu.edu>           cc:

                                         Subject:     How can I merge the
results of two queries. (tds)            
                    08/20/01

                    01:39 AM

                    Please

                    respond to

                    cf-talk

 

 




I have two queries result sets and would like to merge the data together
using ColdFusion.
What would be an approprate method to accomplish this task?
I have ColdFusion Enterprise Edition 4.5.x

Here is an example:

I have one query result set like so:
ID, author, ACCNO
1, Jack, 2
2, Mo, 4
3, Emma, 6
4, Sydney, 8
5, Mary, 11
...

I have another query result set like this:
ACCNO, Title
1, "The board"
2, "The walk"
3, "The sand"
4, "The beach"
5, "The ocean"
6, "The frost"
7, "The building"
8, "The house"
9, "The grass"
10, "The mud"
11, "The car"
...

I want to join these two result sets so that I get a third query result
set like this:
ACCNO, Title, ID, Author
1, "The board", ,
2, "The walk", 1, Jack
3, "The sand", ,
4, "The beach", 2, Mo
5, "The ocean", ,
6, "The frost", 3, Emma
7, "The building", ,
8, "The house", 4, Sydney
9, "The grass", ,
10, "The mud", ,
11, "The car", 5, Mary

I know that in this example I could use the database to perform an outer
join, but the real query sets are not comming from a database.
Thanks in advance.

Sincerely,
Troy

--
Troy Simpson | North Carolina State University
NCSU Libraries | Campus Box 7111 | Raleigh | North Carolina
ph.919.515.3855 | fax.919.513.3330

Some people change when they see the light.
Others, when they feel the heat.
  -- corvis advertisement
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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