我在DolphinDB中执行下列代码:
db = database("dfs://transport")
tb = select top 1000 * from db.loadTable(`autos)
select concat(concat(concat(string(yearOfRegistration),"."),string(monthOfRegistration)),".01") as newcat from tb
报错:The second argument for 'concat' must be a string or a char。其中yearOfRegistration和monthOfRegistration两个字段的类型都是INT。数据如下图所示:
请问怎么解决?
参阅用户手册中concat的说明,第二个参数只能是字符串或字符。你在计算concat(concat(string(yearOfRegistration),"."),string(monthOfRegistration))这个时,第二个参数值是string(monthOfRegistration),这个是字符串向量了,所以报错。可试试下面代码: