you can use ColumnList to tease out the column names and use them to
dynamicly created the query.
<cfquery name="getProj" datasource="#application.DSN#">
SELECT *
FROM tblProj
</cfquery>
<cfset mystring = getProj.ColumnList >
And do a replace to tack on the table name to the vars so the read something
tblProj.id, tblProj.name, etc.
<cfquery name="getEmp" datasource="#application.DSN#">
SELECT *
FROM tblEmp
</cfquery>
<cfset mystring2 = getEmp.ColumnList >
And do a replace to tack on the second table name to the vars
and then going the two lists like so: ListAppend(mystring ,mystring2 )
Then if you know the tables and the ID's you can build the query from the
above.
hth
G
On Tue, May 6, 2008 at 1:22 PM, Richard White <[EMAIL PROTECTED]> wrote:
> hi,
>
> i have 2 coldfusion queries and need to combine them together on their
> primary keys
>
> the problem is, is that i don't know what the column names will be, i only
> know what the primary keys will be.
>
> therefore i have no idea how to join them together based on this. i
> usually join queries together using:
>
> select s.subject id, t.testid from subjects s, tests t etc...
>
> i also know that query on query in coldfusion is very limited. so i would
> like some advice on the best possible way to do this please
>
> Note: i Have looked on cflib and seen a query merge function but it only
> allows me to pass in 1 column name as a primary key whereas my queries have
> more than 1 primary key (1 query has subjectid, testoccasionid - and another
> query has subjectid, testoccasionid, and tesid - so i need to join them up
> based on the subjectid, and testoccasinid)
>
> for example, i have 2 queries:
>
> query1 = subjectID(PK), testOccasionID(PK), .... x amount of additional
> columns
> query2 = subjectID(PK), testOccasionID(PK), testID(PK).... x amount of
> additional columns
>
> they are both queries in coldfusion so i may be wrong but i am thinking
> that i can only use query on query to join them but i am not sure how
>
> thanks for your help
>
> richard
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:304803
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4