# Iterators with tables

**URL:** <https://forum.kx.com/t/iterators-with-tables/13331>\
**Category:** Community Support\
**Tags:** imported, kdb-and-q\
**Created:** [October 12, 2023, 12:00am UTC](https://forum.kx.com/t/iterators-with-tables/13331 "2023-10-12T00:00:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kb1](https://avatars.discourse-cdn.com/v4/letter/k/e47774/32.png) [@kb1](https://forum.kx.com/u/kb1)\
**Post date:** [October 12, 2023, 12:00am UTC](https://forum.kx.com/t/iterators-with-tables/13331/1 "2023-10-12T00:00:00Z")

</div>

[https://learninghub.kx.com/forums/topic/iterators-with-tables](https://learninghub.kx.com/forums/topic/iterators-with-tables)

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

&nbsp;

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

Need help with this query.

---

<div class="post-metadata">

**Author:** ![cillianreilly](https://avatars.discourse-cdn.com/v4/letter/c/7bcc69/32.png) [@cillianreilly](https://forum.kx.com/u/cillianreilly)\
**Post date:** [October 12, 2023, 12:00am UTC](https://forum.kx.com/t/iterators-with-tables/13331/2 "2023-10-12T00:00:00Z")

</div>

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
```
