英文:
SQL to convert EntryDate (column) to NULL if Country (column) is Gabon
问题
我正在寻找正确执行以下操作的SQL代码。在国家为Gabon的情况下,我在将现有日期值转换为NULL方面遇到了困难。感谢任何帮助。
CASE
WHEN COUNTRY = 'GABON'
THEN NULL
ELSE ENTRYDATE
END AS ENTRYDATE
英文:
I am looking for SQL code to do the following correctly. I am struggling converting the existing date value to NULL in the case where the country is Gabon. Any help appreciated.
CASE
WHEN COUNTRY = 'GABON'
THEN ENTRYDATE IS NULL
END AS ENTRYDATE
CASE
WHEN COUNTRY = 'GABON'
THEN ENTRYDATE IS NULL
END AS ENTRYDATE
答案1
得分: 0
将CASE
WHEN
条件正确格式化。
CASE WHEN COUNTRY = '加蓬' THEN cast(null as Datetime) ELSE ENTRYDATE END AS ENTRYDATE
注意:根据ENTRYDATE
列的数据类型进行转换。
英文:
Format CASE
WHEN
condition properly.
CASE WHEN COUNTRY = 'GABON' THEN cast(null as Datetime) ELSE ENTRYDATE END AS ENTRYDATE
Note: Cast The data Type Based on ENTRYDATE
Column
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论