use query.setFieldPrefix
<cfset var optionValueGW =
getModelGlue().getORMService().createGateway("option_value") />
<cfset var query = optionValueGW.createQuery() />
<cfset query.innerjoin("option_value", "option_type", "option_type") />
<cfset query.setFieldPrefix("option_value", "table_prefix") />
<cfset query.setFieldPrefix("option_type", "a_different_prefix") />
<cfset order = query.getOrder() />
<cfset order.setAsc("option_type", "option_description") />
<cfdump var="#optionValueGW.getByQuery(query)#">
Cheers, Chris
________________________________
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Doug Arthur
Sent: 14 July 2007 05:42
To: [email protected]
Subject: [Reactor for CF] Duplicate column names in a join
How would I keep column names unique in a query with a join
where each table has a like column name?
<cfset var optionValueGW =
getModelGlue().getORMService().createGateway("option_value") />
<cfset var query = optionValueGW.createQuery() />
<cfset query.innerjoin("option_value", "option_type",
"option_type") />
<cfset order = query.getOrder() />
<cfset order.setAsc("option_type", "option_description") />
<cfdump var="#optionValueGW.getByQuery(query)#">
I get two columns called "active" and two columns called
"option_type_id".
So, to rephrasing my question: How do I distinguish which table
each column belongs to in the query?
Thanks!
- Doug
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at:
http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --