That's perfect, thank you James!
>>-----Original Message----- >>From: James Holmes [mailto:james.hol...@gmail.com] >>Sent: 23 May 2011 03:12 >>To: cf-talk >>Subject: Re: SQL Quandary >> >> >> >>It can be. >> >>Taking your last example: >> >>IF (SELECT checkProjected FROM tbl_Params WHERE siteID = 1) = 1 >>select projected from tbl_stockItems where projected > 10 >>else >>select projected from tbl_stockItems where projected <10 >> >> >>This can be written as: >> >>select projected from tbl_stockItems >>where >>( >> (SELECT checkProjected FROM tbl_Params WHERE siteID = 1) = 1 AND >>projected > 10 >>) >>OR >>( >> (SELECT checkProjected FROM tbl_Params WHERE siteID = 1) <> 1 AND >>projected < 10 >>) >> >>Since the subquery clause can only be true for one of the AND clauses, >>only one set of results will be returned. No virus found in this outgoing message. Checked by AVG - www.avg.com Version: 9.0.901 / Virus Database: 271.1.1/3654 - Release Date: 05/22/11 19:33:00 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:344835 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm