【发布时间】:2022-01-16 23:38:09
【问题描述】:
任务如下。我有一个包含大量属性的代码。对于其中一个属性,假设这是卡片类型 card_type='universal',您需要添加以下条件: card>='129897' and card='093750' and card
【问题讨论】:
任务如下。我有一个包含大量属性的代码。对于其中一个属性,假设这是卡片类型 card_type='universal',您需要添加以下条件: card>='129897' and card='093750' and card
【问题讨论】:
我认为你可以使用嵌套大小写。 如果您不想选择参数列,可以使用子查询来隐藏列。因此,如果您需要,只需将其添加到外部选择列表中即可。
SELECT col1, col2
FROM
(SELECT
col1, col2,
case when card_sybtype in ('VISA','MS') THEN -- universal case
case when card>='129897' and card <='293965' then 'unnamed'
when card>='093750' and card <='903750' then 'personal' end
else null
end as param_adhoc
FROM tab
) rs
【讨论】: