sql 中 case 条件的替代选项
如何检查列值是否为零
我想插入 50 个列值,每一列我想检查该值是否为 0。如果值为 0,那么它应该为 null
查询
insert into table1 values (Case when column1 = '0' then null else column1 end, .....
Case when column50 = '0' then null else column50 end)
上面的查询正在工作,但是查询长度太长,因为我正在使用上面的 50 列查询,
有任何替代选项可以检查列值是否为 0。
像这样 if(column1, 0) then null
需要查询帮助
How to check the column value zero or not
I want to insert 50 column values, each column i want to check whethere the value is 0 or not. If the value is 0 then it should be null
Query
insert into table1 values (Case when column1 = '0' then null else column1 end, .....
Case when column50 = '0' then null else column50 end)
The above query is working, but query length is too long because i am using the above query of 50 column's
there is any alternative option is there for check the column value is 0 or not.
like this if(column1, 0) then null
Need Query Help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用 NULLIF:
Try using NULLIF: