可以建一个完整price列的表与原表进行左连接,再使用nullFill方法填充空值为0:
t=table(100 101 103 106 as price,take(10,4) as n) t1=table(t.price.min()..t.price.max() as price) select price,nullFill(n,0) as n from lj(t1,t,`price)
连接结果如下:
price n 100 10 101 10 102 0 103 10 104 0 105 0 106 10