case - SQL - Creating A Conditional Where Clause For This Simple Query -
i've been trying create conditional clause query below keep seeing many alternatives i'm not sure use in case.
what need along lines of this: (though of course code wrong)
where cascasetype='m' , cascurrentworkflowid=990 , cmsdatecreated between @fromdate , @todate case @wfstatus when @wfstatus=1 eveworkflowid<100 when @wfstatus=2 eveworkflowid<200 when @wfstatus=3 eveworkflowid<300 when @wfstatus=4 eveworkflowid<400 else 0 end
so when choose wfstatus parameter 1, automatically engage section of clause bringing out results eveworkflowid less 100.
any appreciated!
thanks
where cascasetype='m' , cascurrentworkflowid=990 , cmsdatecreated between @fromdate , @todate , eveworkflowid < case @wfstatus when 1 100 when 2 200 when 3 300 when 4 400 else 0 end
Comments
Post a Comment