运行 sql 查询数据块时出现不匹配错误
Missmatch Error when running sql query on databricks
我正在尝试 运行 对数据块进行简单的 sql 查询,但出现不匹配错误。我不确定如何解决这个问题
示例数据
我的代码:
%sql
select UnitPrice, InvoiceDate
from tester2
where InvoiceDate = 2010-01-12
错误
Error in SQL statement: AnalysisException: cannot resolve '(tester2.`InvoiceDate` = ((2010 -
1) - 12))' due to data type mismatch: differing types in '(tester2.`InvoiceDate` = ((2010 - 1)
- 12))' (date and int).; line 3 pos 6;
'Project ['UnitPrice, 'InvoiceDate]
日期时间和日期数据类型的值应该用单引号引起来:
select UnitPrice, InvoiceDate
from tester2
where InvoiceDate = '2010-01-12'
我正在尝试 运行 对数据块进行简单的 sql 查询,但出现不匹配错误。我不确定如何解决这个问题
示例数据
我的代码:
%sql
select UnitPrice, InvoiceDate
from tester2
where InvoiceDate = 2010-01-12
错误
Error in SQL statement: AnalysisException: cannot resolve '(tester2.`InvoiceDate` = ((2010 -
1) - 12))' due to data type mismatch: differing types in '(tester2.`InvoiceDate` = ((2010 - 1)
- 12))' (date and int).; line 3 pos 6;
'Project ['UnitPrice, 'InvoiceDate]
日期时间和日期数据类型的值应该用单引号引起来:
select UnitPrice, InvoiceDate
from tester2
where InvoiceDate = '2010-01-12'