我需要帮助建立了以下标准的SQL查询单个SQL查询更新多个列:符合条件
有Oracle数据库3列,我需要更新这些列的一个检查,如果第1为空然后更新并且不触及其他两列,如果1st不为空,则更新2nd并且不更新第3列否则如果第3列为空更新第3列。
,我可以构建查询是:
update temp set
flg1 =
case flg1
when null then 'Y' else flg1 end,
flg2 =
case flg2
when null then 'Y' else flg2 end,
flg3 =
case flg3
when null then 'Y' else flg3 end,
where id = 132
我知道上面的查询是我想要的,需要帮助不同..
什么错误你收到 – Sachu
它不是错误,查询不正确,我需要建立查询的帮助。 –
如果flag1和flag2不为空,那么flag3会更新? – Sachu