No, the join isn't *that* intensive on the database since the country
table isnt very large (and won't get too much larger...   I mean, it
takes cycles, but its not something that will slow down your server too
much....), but it's more about separating business logic from utility functionality on your site, since
doing the join will prevent you from caching your country-list query to
optimize it.

-Dov

On Sun, 8 Feb 2004, Stuart Kidd wrote:

> Thanks for that Dov.  I'll keep them separate then.  Do you mean don't
> join them as it'll take too much processing power?
>
> I'll look into that cachedwitin.  Thanks,
>
> Stuart
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: 08 February 2004 21:46
> To: CF-Talk
> Subject: Re: Database Joins
>
> I think you should keep them separate, and cache the country query,
> since
> it's likely never to change...(using cfquery's cachedwithin parameter or
> even writing that to static html and using that)... That's  more
> performant than worrying about condensing 2 queries into one.... If you
> want one query though for other reasons, you can just do a select on all
> the PropertyCountryList and LEFT JOIN it to PropertyAgentList ON the
> country attribute. Then there'd be only one non-empty PropertyAgentID...
> But I highly recommend considering the 2 queries very differently as one
> is site-wide and one as user-specific.
>
> HTH
> d
>
> On Sun, 8 Feb 2004, Stuart Kidd wrote:
>
> > Hi guys,
> >
> > I'm trying to do one database query (SELECT) without having to do 2
> > separate ones.
> >
> > I have two tables.  One called PropertyAgent and then another called
> > PropertyCountryList.
> >
> > In PropertyAgent, there is a field called PropertyAgentCountry
> (numeric)
> > which was inserted originally using a choice of the field
> > PropertyCountryListID (numeric) from table PropertyAgentCountry.
> >
> >
> > At the moment I have two queries, but I'm thinking there must be away
> > around it.
> >
> > // getting the agent details info (which country he is from)
> > <CFQUERY NAME="AgentDetails" datasource="020">
> > SELECT PropertyAgentID, PropertyAgentCountry
> > FROM PropertyAgent
> > WHERE PropertyAgentID = #Client.PropertyAgentID#
> > </CFQUERY>
> >
> > // getting list of countries to populate form
> > <CFQUERY NAME="GetPropertyCountryList" datasource="020">
> > SELECT PropertyCountryListID, PropertyCountryListName
> > FROM PropertyCountryList
> > ORDER by PropertyCountryListName ASC
> > </CFQUERY>
> >
> > // outputting to the form.
> >
> > <cfselect name="PropertyAgentCountry" class="FormSTYLE2">
> > <cfoutput query="GetPropertyCountryList">
> > <option value="#PropertyCountryListID#" <cfif PropertyCountryListID is
> >
> AgentDetails.PropertyAgentCountry>selected</cfif>>#PropertyCountryListNa
> > me#</option>
> > </cfoutput>
> > </cfselect>
> >
> > Any ideas greatly appreciated,
> >
> > Stuart
> >
> >
> >
> >
>   _____
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to