Found it myself.  Well, it's at least one way to do it.  Here's an example....

select *
from tracking t1
where 1 = case #form.cat#
          when 1 then (
                   select 1 from tracking t2
                   where t1.prog=t2.prog
                           and t2.prog not in (70,80)
          )
          when 2 then (
                   select 1 from tracking t2
                   where t1.prog=t2.prog
                           and t2.prog not in (100,110)
          )
        end

I was trying to use "exists" before, and it doesnt' look like you can
have that in a CASE statement.



On 8/22/07, David Gardner <[EMAIL PROTECTED]> wrote:
> This is some code that communicates what I want to do.  I want to pass
> in a number that is the key that will match up with what's in the SQL
> code.
>
> Basically, I want to have different sets of criteria that are brought
> into play depending on the var coming in.
>
> select *
> from ext_tracking
> where category not in CASE #form.cat#
>     WHEN 1 THEN (70,80)
>     WHEN 2 THEN (80,100,110,120)
>     WHEN 3 THEN (70,80,100,110,120)
>     WHEN 4 THEN (70,100,110,120)
> END
>
>
> I don't care if a IF THEN or a CASE statement is used.
>
> And yes, I know that I could do it with more CFML involvement, but I'd
> rather not do that.  This is just representative code that illustrates
> the one piece I need to make the whole thing work.
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta

Archive: http://www.houseoffusion.com/groups/SQL/message.cfm/messageid:2911
Subscription: http://www.houseoffusion.com/groups/SQL/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.6

Reply via email to