我正在尝试搜索日期介于两个值之间的行:
"mappings": {
"company": {
"properties": {
"name": {
"type": "keyword"
},
"employee": {
"type": "object",
"properties": {
"age": {
"type": "long"
}
}
}
}
}
}
错误:
消息206,级别16,状态2,第1行操作数类型冲突:日期与int不兼容
答案 0 :(得分:3)
请注意between
,我会改用:
select battery_volts
from ems
where date >= '20180606' and date < '20180607';
这里是一个great article,它扩展了在之间的警告。
答案 1 :(得分:1)
使用单引号('
)引用日期:
SELECT battery_volts
FROM ems
WHERE date BETWEEN '20180606' AND '20180606';
答案 2 :(得分:1)
如果数据类型为date
,则可以
select battery_volts
from ems
where date between '2018-06-06' and '2018-06-07'