# Update with a sub-query

**URL:** <https://community.questdb.com/t/update-with-a-sub-query/835>\
**Category:** Community\
**Created:** [May 19, 2025, 11:30am UTC](https://community.questdb.com/t/update-with-a-sub-query/835 "2025-05-19T11:30:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BepTheWolf](https://yyz2.discourse-cdn.com/flex004/user_avatar/community.questdb.com/bepthewolf/32/377_2.png) [@BepTheWolf](https://community.questdb.com/u/BepTheWolf)\
**Post date:** [May 19, 2025, 11:30am UTC](https://community.questdb.com/t/update-with-a-sub-query/835/1 "2025-05-19T11:30:48Z")

</div>

Hi, I’m trying a query to perform an update from a sub-query, but it gives me an error.  
The query is as follows:

WITH up AS (select index\_time, ColA, ColB from MyTabTmp)  
UPDATE MyTab mt  
SET _ **mt.ColA** _ = up.ColA, mt.ColB = up.ColB  
FROM up WHERE mt.index\_time=up.index\_time;

‘=’ expected

* * *

I get the same error with your query, see example at the link:

> **[UPDATE keyword | QuestDB](https://questdb.com/docs/reference/sql/update/#examples)**
>
> UPDATE SQL keyword reference documentation.

WITH up AS (  
SELECT p.ask - p.bid AS spread, s.timestamp  
FROM prices p  
JOIN instruments i ON p.symbol = i.symbol  
WHERE i.type = ‘BOND’  
)  
UPDATE spreads s  
SET s.spread = up.spread  
FROM up  
WHERE s.timestamp = up.timestamp;

---

<div class="post-metadata">

**Author:** ![nwoolmer](https://yyz2.discourse-cdn.com/flex004/user_avatar/community.questdb.com/nwoolmer/32/24_2.png) [@nwoolmer](https://community.questdb.com/u/nwoolmer)\
**Post date:** [May 19, 2025, 12:47pm UTC](https://community.questdb.com/t/update-with-a-sub-query/835/2 "2025-05-19T12:47:25Z")

</div>

Hey @BepTheWolf , we’ll look into this and come back to you!

---

<div class="post-metadata">

**Author:** ![nwoolmer](https://yyz2.discourse-cdn.com/flex004/user_avatar/community.questdb.com/nwoolmer/32/24_2.png) [@nwoolmer](https://community.questdb.com/u/nwoolmer)\
**Post date:** [May 19, 2025, 4:53pm UTC](https://community.questdb.com/t/update-with-a-sub-query/835/3 "2025-05-19T16:53:04Z")

</div>

Indeed, this looks like a parsing bug, where the parser does not handle the `.` properly. We’ll fix it!
