我想请你帮忙。我想创建一个标志列,它将标记特定的合同编号为1,其中“CLOSED”列在某些行中为空。
我试过
case when CLOSED is null then 1 else 0 end as flag
group by CONTRACT_NUMBER
但它不起作用。感谢您的回复
答案 0 :(得分:2)
我认为您需要解析max()
:
<强> demo 强>
select t.*,
max(case when closed is null
then 1
else 0
end) over (partition by contract_number) as flag
from t