-
case in a where clause
A deveoper just asked me if there is a way to use a case in a where clause. Is this feasible or will we have to do some dynamic sql
where (cr.cb_routine = 1 or cr.cb_urgent = 1 or cr.cb_emergency_room = 1
or cr.cb_on_site_clinic = 1 or cr.cb_retro_request = 1 or cr.cb_initial = 1
or cr.cb_followup = 1 or cr.cb_in_person = 1 or cr.cb_telemed = 1
or cr.df_within is not null or cr.df_provider is not null
or cr.df_proc_test_spec is not null or cr.df_provider_area is not null)
and p.privacy_level = 10
and pe.Location_ID = @Location and
case when @status = 'Pended' then cr.cb_supp_info_need1 = 1
case when @status = 'Criteria for service not met' then cr.cb_criteria_not_1 = 1
case when @status = 'Other' then cr.cb_other_1 = 1
case when @status = 'All' then
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|