【问题标题】:There's an error "Temporal data comparison should have the same data type."出现错误“时间数据比较应具有相同的数据类型”。
【发布时间】:2021-10-09 09:17:29
【问题描述】:

创建的表如下:

login("admin", "123456")
if(existsDatabase("dfs://compoDB")){
    dropDatabase("dfs://compoDB")
}
    
n = 1000000
ID = rand(100, n)
dates = 2017.08.07T00:00:00.000..2017.08.08T00:00:00.000
date = rand(dates, n)
x = rand(10.0, n)
t = table(ID, date, x)
    
dbDate = database(, VALUE, 2017.08.07..2017.08.11)
dbID=database(, RANGE, 0 50 100)
db = database("dfs://compoDB", COMPO, [dbDate, dbID])
    
pt = db.createPartitionedTable(t, `pt, `date`ID)
pt.append!(t)

然后执行如下查询:

select * from loadTable("dfs://compoDB", "pt") where date between 2017.08.07:2017.08.08

有一条错误消息:

Temporal data comparison should have the same data type.

为什么

【问题讨论】:

    标签: sql partitioning dolphindb


    【解决方案1】:

    where 子句中的日期类型应与表格中的相同。正确的查询语句如下:

    select * from loadTable("dfs://compoDB", "pt") where date between 2017.08.07T00:00:00.000:2017.08.08T23:59:59.999
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多