Skip to content

Commit

Permalink
non-transactional-dml: update t3. to t3.id (#19039) (#19040)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Oct 8, 2024
1 parent 5cdedf1 commit 4836838
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 4836838

Please sign in to comment.