Hi All,
Is the code snippet below the correct way to get information from 2
tables? Should I specify a join in the SQL? This seems to work with
out specifying it however.
Thanks for any suggestions.
-Brian
<cfcomponent>
<cffunction name="ListBusinesses" returntype="query">
<cfargument name="CatID" required="false" type="numeric" default="0">
<cfargument name="bizname" required="false" type="string">
<cfargument name="CountyID" required="false" type="numeric">
<cfargument name="City" required="false" type="string">
<cfargument name="stateid" required="false" type="numeric">
<cfargument name="zip" required="false" type="string">
<cfargument name="bizid" required="false" type="numeric">
<cfquery name="getBusinesses"
datasource="kenhugh_america411">
SELECT
*
FROM
tblBiz,tblLocation
WHERE
tblBiz.Countyid = tblLocation.Countyid
AND
CatID = #Val(Arguments.CatID)#
<cfif isdefined('arguments.bizname')>
AND bizname LIKE '%#arguments.bizname#%'
</cfif>
<cfif arguments.CountyID GT 0 >
AND CountyID = #val(arguments.CountyID)#
</cfif>
<cfif isdefined('arguments.City') >
AND BizCity LIKE '%#arguments.City#%'
</cfif>
<cfif arguments.stateid GT 0 >
AND stateid = #val(arguments.stateid)#
</cfif>
<cfif isdefined('arguments.zip')>
AND bizzip LIKE '%#arguments.zip#%'
</cfif>
<cfif arguments.bizid GT 0 >
AND bizid = '#arguments.bizid#'
</cfif>
</cfquery>
<cfreturn getBusinesses>
</cffunction>
</cfcomponent>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 and Flex 2
Build sales & marketing dashboard RIAâs for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT
Archive:
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:2838
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15