Reputation: 1
I am trying to convert this case statement:
(CASE UPPER(dc.source_name) WHEN 'DART' THEN dc.ad_campaign_id ELSE dc.cfid END) AS rodeo_order_id
into a condition in the where
clause.
Any help is appreciated!
Thanks, S
Upvotes: 0
Views: 894
Reputation: 1066
I have to admit I don't understand need for this, but something like this might be the solution (assuming ad_campaign_id
and cfid
are of the same type):
select dc1.ad_campaign_id
from <table> dc1
where UPPER(dc.source_name) = 'DART'
UNION
select dc2.cfid
from <table> dc2
where UPPER(dc.source_name) != 'DART'
Upvotes: 0
Reputation: 28499
This is not possible. The Case-Expression in the Select clause decides the content of a returned column for all returned rows while the where-clause defines which rows are returned.
You have to give a better explanation what problem you have in order to get an answer.
Upvotes: 1