needed. I am guessing you have more than one type per prod. Now I am
going on no caffeine right now, so the code might be flawed, but I
think the general idea is there. Was thinking something like this:
<cfquery name="myData" datasource="#App.DSN#">
SELECT P.TypeID, T.TypeDesc
FROM tblProducts P LEFT OUTER JOIN tblTypes T ON P.TypeID = T.TypeID
WHERE ProdID = <cfqueryparam value="#URL.ProdID#" cfsqltype="cf_sql_integer">
ORDER BY P.TypeID, T.TypeDesc
</cfquery>
<cfif myData.RecordCount>
<cfoutput query="myData" group="TypeID">
ID = #TypeID#
<cfoutput>#Trim(TypeDesc)#</cfoutput>
</cfoutput>
<cfelse>
Default
</cfif>
On Thu, 7 Oct 2004 14:29:08 -0500, Donna French <[EMAIL PROTECTED]> wrote:
> Would the join of the two tables improve performance?
>
> Thanks,
> Donna
>
>
>
>
> On Thu, 7 Oct 2004 14:19:34 -0500, Aaron Rouse <[EMAIL PROTECTED]> wrote:
> > Why don't you just join your two tables within your query and avoid
> > the need for a switch/case? And if no recordcount then display the
> > default template.
> >
> > On Thu, 7 Oct 2004 14:02:49 -0500, Donna French <[EMAIL PROTECTED]> wrote:
> > > Okay, here's what I've come up with so far. Let me know any comments -
> >
> >
> > > good, bad or indifferent.
> > >
> > > <cfquery name="rsDetails" datasource="#dsn#">
> > > SELECT *
> > > FROM tblProducts
> > > WHERE ProdID = #URL.ProdID#
> > > </cfquery>
> > >
> > > <cfoutput query="rsDetails" datasource="#dsn#">
> > > <cfswitch _expression_="#Trim(TypeID)#">
> > > <cfcase value="1">
> > > <!--- Display layout for TypeID 1 --->
> > > <cfquery name="rsType1" datasource="#dsn#">
> > > SELECT *
> > > FROM tblTypes
> > > WHERE TypeID = 1
> > > </cfquery>
> > > <cfoutput query="rsType1">
> > > #Trim(TypeDesc)#
> > > </cfoutput>
> > > </cfcase>
> > > <cfcase value="2">
> > > <!--- Display layout for TypeID 2 --->
> > > <cfquery name="rsType2" datasource="#dsn#">
> > > SELECT *
> > > FROM tblTypes
> > > WHERE TypeID = 2
> > > </cfquery>
> > > <cfoutput query="rsType2">
> > > #Trim(TypeDesc)#
> > > </cfoutput>
> > > </cfcase>
> > > <cfcase value="3">
> > > <!--- Display layout for TypeID 3 --->
> > > <cfquery name="rsType3" datasource="#dsn#">
> > > SELECT *
> > > FROM tblTypes
> > > WHERE TypeID = 3
> > > </cfquery>
> > > <cfoutput query="rsType3">
> > > #Trim(TypeDesc)#
> > > </cfoutput>
> > > </cfcase>
> > > <cfdefaultcase>
> > > <!--- Display default layout --->
> > > <cfinclude template="defaultdetails.cfm">
> > > </cfdefaultcase>
> > > </cfswitch>
> > > </cfoutput>
> > >
> > > TIA,
> > > Donna
> > >
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

