我有一份报告,其中有一列包含不同的状态。如何从只有东和西而不是单个状态的参数中过滤这些状态?
我对状态列表的查询是:
select distinct
state
from contract
我对参数的查询是:
select distinct
case when STATE = 'CA' or STATE = 'WA' or STATE = 'MO'
or STATE = 'OR' or STATE = 'NV' or STATE = 'ID'
or STATE = 'MT' or STATE = 'WY' or STATE = 'UT'
or STATE = 'AZ' or STATE = 'CO' or STATE = 'NM'
or STATE = 'ND' or STATE = 'SD' or STATE = 'NE'
or STATE = 'KS' or STATE = 'OK' or STATE = 'TX'
or STATE = 'LA' or STATE = 'AR' or STATE = 'IA'
or STATE = 'MN' or STATE = 'HI' or STATE = 'AK' then 'West'
when STATE = 'MI' or STATE = 'OH' or STATE = 'PA'
or STATE = 'NJ' or STATE = 'WI' or STATE = 'IL'
or STATE = 'IN' or STATE = 'KY' or STATE = 'TN'
or STATE = 'MS' or STATE = 'AL' or STATE = 'GA'
or STATE = 'FL' or STATE = 'SC' or STATE = 'NC'
or STATE = 'VA' or STATE = 'WV' or STATE = 'MD'
or STATE = 'DE' or STATE = 'CT' or STATE = 'RI'
or STATE = 'NY' or STATE = 'MA' or STATE = 'VT'
or STATE = 'NH' or STATE = 'ME' then 'East'
else null end as 'Territory Selection'
from contracts
我的参数将显示为 [All][West][East]。我想如果我在 [Territory Selection] 中将过滤器设置为 [State],它会将各州过滤为属于东部或西部,但它没有按预期工作。任何指针将不胜感激!