英文:
How to set WHERE filter to only show instances of a column where blank in GBQ SQL?
问题
我正在使用WHERE
函数来筛选时间戳列为空的实例。
我正在处理的数据集在cancelled_datetime
列中填充了日期,如果库存已交付。
我想仅显示供应商Walmart的数据,其中cancelled_datetime
列没有数据。我该如何操作?
以下是我的脚本,但出现了错误消息:
{无法将字面量“”转换为TIMESTAMP}
我尝试过:
WHERE supplier_code = "Walmart"
AND cancelled_datetime <> ""
我期望收到一个表,显示来自供应商Walmart的数据,不包括日期。
英文:
I am using the WHERE
function to filter out instances where a column of timestamp is empty.
The data set I am working with populates a date in the column cancelled_datetime
if stock is delivered.
I want to only show data of supplier Walmart where there is no data in the cancelled_datetime
column. How do I go about doing so?
Below is my script that breaks with the error message:
>{Could not cast literal "" to type TIMESTAMP}
I tried:
WHERE supplier_code = "Walmart"
AND cancelled_datetime <> ""
I was expecting to receive a table indicating data from supplier Walmart that does not include a date.
答案1
得分: 0
错误消息表明cancelled_datetime
列是一个时间戳类型,它可以是有效的时间戳或NULL值。根据您的需求,您可以使用IS NULL筛选条件来获取您想要的结果。
以下是查询:
WHERE supplier_code = "Walmart"
AND cancelled_datetime IS NULL
英文:
The error message suggests that cancelled_datetime
column is a timestamp type, which it will be either a valid timestamp or a NULL value. For what you are looking for, you can use IS NULL filter to get the result you want.
Here is the query:
WHERE supplier_code = "Walmart"
AND cancelled_datetime IS NULL
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论