To get at data stored in fields with the same name, you can alias
the field names like this:

Select d.total as breakdown_total, b.total as data_total.....

Then you can output like this:

<cfoutput query="getRep">#breakdown_total#</cfoutput>

Also...syntax for table joins should usually looks like this:

>From tablename1 b inner join tablename2 d on b.primarykey =
d.primarykey

Then you can filter the results in your where clause:

Where b.wid = #attributes.wid#.....



----- Original Message -----
From: "John Gedeon" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, September 23, 2002 7:21 PM
Subject: Two tables same column name?


> I have a query where i join two tables. and both tables have a
field which
> are titled the same but each table has a different value. is
there a way
> for pulling the two different values out in cold fusion or do i
have to use
> multiple selects??
>
> <cfquery name="getRep"
>    datasource="#session.datasource#"
>    dbserver="#session.dbserver#">
>   SELECT *
>   FROM trip_flow_breakdown b, trip_flow_data d
>   WHERE b.wid = #attributes.wid# AND b.fid = #attributes.fid#
AND b.id =
> #attributes.id#
>   AND d.wid = #attributes.wid# AND d.fid = #attributes.fid#
> </cfquery>
>
>    the field i want to get is total but if i use
>   <cfoutput query="getRep">#total#</cfoutput> i only get the
value of the
> first table in the from clause. any one have a solution?
>
> <>< Proverbs 3:5 "Trust in the Lord with all your heart and
lean not on
> your own understanding;"
>
>

______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to