1

I have a table t

t=table(100 101 103 106 as price,take(10,4) as n)

    price n
    100   10
    101   10
    103   10
    106   10

For the missing values of the column price, like 102, 104, and 105, I want to fill it with n=0.

price  n
100    10
101    10
102    0
103    10
104    0
105    0
106    10
jinwandalaohu
  • 226
  • 1
  • 7

1 Answers1

3

Not sure how will you generate the price seq, but you can do something like:

t=table(100 101 103 106 as price,take(10,4) as n)
t2=table(100..106 as price)
select price, n.nullFill(0) from t2 left join t on t2.price = t.price
Hanwei Tang
  • 413
  • 3
  • 10