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.

--
WSS4CF - WS-Security framework for CF
http://wss4cf.riaforge.org/



On 23 May 2011 09:29, Jenny Gavin-Wear <jenn...@fasttrackonline.co.uk> wrote:
>
> because the intention is not a simple WHERE search expression.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:344832
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to