You all are really great and I hope I can one day return the favor of
helping someone on the list too.

Thanks,
Donna

On Thu, 7 Oct 2004 16:11:52 -0400, Joe Rinehart <[EMAIL PROTECTED]> wrote:
> Donna -
>
> Very much so - there'd only be one trip to the database, and a lot
> less code to run.  I think this will replace all of your code, as long
> as I understood the original correctly:
>
> <!--- Start Code --->
> <cfquery datasource="#dsn#" name="getLayout">
>   SELECT t.TypeDesc
>   FROM tblProducts p JOIN tblTypes t ON p.TypeId = t.TypeId
>   WHERE ProdId = <cfqueryparam cfsqltype="cf_sql_int" value="#URL.ProdID#">
> </cfquery>
>
> <cfif getLayout.recordCount>
>   <cfoutput>#getLayout.TypeDesc#</cfoutput>
> <cfelse>
>   <cfinclude template="defaultdetails.cfm">
> </cfif>
> <!--- End Code --->
>
> -joe
>
> 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]

Reply via email to