Skip to content

Commit

Permalink
non-transactional-dml: update t3. to t3.id (#19039)
Browse files Browse the repository at this point in the history
  • Loading branch information
hfxsd authored Oct 8, 2024
1 parent 337c2e8 commit bf10a2e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions non-transactional-dml.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ This error occurs when the `WHERE` clause concatenated in a query involves table
```sql
BATCH ON test.t2.id LIMIT 1
INSERT INTO t
SELECT t2.id, t2.v, t3. FROM t2, t3 WHERE t2.id = t3.id
SELECT t2.id, t2.v, t3.id FROM t2, t3 WHERE t2.id = t3.id
```

```sql
Expand All @@ -347,15 +347,15 @@ If the error occurs, you can print the query statement for confirmation by using
```sql
BATCH ON test.t2.id LIMIT 1
DRY RUN QUERY INSERT INTO t
SELECT t2.id, t2.v, t3. FROM t2, t3 WHERE t2.id = t3.id
SELECT t2.id, t2.v, t3.id FROM t2, t3 WHERE t2.id = t3.id
```

To avoid the error, you can move the condition related to other tables in the `WHERE` clause to the `ON` condition in the `JOIN` clause. For example:

```sql
BATCH ON test.t2.id LIMIT 1
INSERT INTO t
SELECT t2.id, t2.v, t3. FROM t2 JOIN t3 ON t2.id=t3.id
SELECT t2.id, t2.v, t3.id FROM t2 JOIN t3 ON t2.id = t3.id
```

```
Expand Down

0 comments on commit bf10a2e

Please sign in to comment.