Why not just write a join in your query, like this:
tblAuthors
ID, Author, ACCNO
tblBooks
ACCNO, Title
SELECT
a.ID
, a.Author
, a.ACCNO
, b.Title
FROM
tblAuthors a
, tblBooks b
WHERE
a.ACCNO = b.ACCNO
I think this is what you're looking for.
Hope this helps,
-Tyson
-----Original Message-----
From: Brent Goldman [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 21, 2001 8:46 PM
To: CF-Talk
Subject: RE: How can I merge the results of two queries. (tds)
Hi,
You can only merge two queries using CF5, because you need to be able to do
queries-of-queries, with one of the queries joining the other two queries
using SQL. But I guess you can spend hours and hours writing a custom tag
that writes its own query using the query functions (QueryNew, QueryAddRow,
QueryAddColumn, QuerySetCell) based on two queries that were input into
it...
-Brent
-----Original Message-----
From: Troy Simpson [mailto:[EMAIL PROTECTED]]
Sent: Sunday, August 19, 2001 1:09 PM
To: CF-Talk
Subject: How can I merge the results of two queries. (tds)
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