元编程里能做值的变量替换吗

元编程里面能不能做值的变量替换?比如 where Date = 2015.01.15 想写成 where Date = $(date),这里的 date 是一个变量。能实现么?

请先 登录 后评论

1 个回答

wale
  1. 可以用字符串拼接的方式实现

  2. 用sql()函数生成,sql — DolphinDB 2.0 documentation 

n=100;
t=table(2020.01.01 + 0..(n-1) as timestamp, rand(`IBM`MS`APPL`AMZN,n) as symbol, rand(10.0, n) as value)
d = 2020.01.01
sql(sqlCol("*"), t, <timestamp=d>).eval()
请先 登录 后评论