try <cfquery name="myQuery" dbtype="query"> Select id from myAnotherQuery Where [some where clause] </cfquery>
myQuery.RecordCount EQ 0 On 2 July 2013 11:38, Nathan Chen <[email protected]> wrote: > > All: > > I have a simple query of query as follow: > <cfquery name="myQuery" dbtype="query"> > Select count(*) as r_count from myAnotherQuery > Where [some where clause] > </cfquery> > > I want the result to be dislayed as zero If it returns no records, So I > use val() function <cfoutput>#val(myQuery.r_count)#</cfoutput>, but it > doesn't work; it returns an empty string, not zero when no records are > returned. Is there a quick way to detect the null and return 0? > > Nathan > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356094 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

