cancel
Showing results for 
Search instead for 
Did you mean: 

Iterators with tables

KB
New Contributor

Hello All!

I have a table similar to this:

sym    |    price                   |    level    |    lowertime | upperTime

-------|---------------------|----------|----------------|---------------

`abc        10.0 20.3 13.5...         15.0         null                  null

`cde       11.0 21.3 13.5...             16.0         null                  null

 

 I need to check if for each sym, if any price<=level then update upperTime:1.

Need help with this query.

1 ACCEPTED SOLUTION

cillianreilly
New Contributor III

Assuming the sym column in your original table is distinct:

q)update upperTime:1 from t where any each price<=level
sym price        level lowerTime upperTime
------------------------------------------
abc 10 20.3 13.5 15              1
cde 11 21.3 13.5 16              1

View solution in original post

1 REPLY 1

cillianreilly
New Contributor III

Assuming the sym column in your original table is distinct:

q)update upperTime:1 from t where any each price<=level
sym price        level lowerTime upperTime
------------------------------------------
abc 10 20.3 13.5 15              1
cde 11 21.3 13.5 16              1