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