Removing duplicate results while using UNION SELECT

前端 未结 2 1507
梦谈多话
梦谈多话 2021-01-12 03:57

Ive got a problem with a MySQL query.

Let\'s say, we have two tables:

id qty

1......1

2......1

3......1

4......3

2条回答
  •  日久生厌
    2021-01-12 04:45

    You can use UNION DISTINCT. Maybe it runs...

    SELECT * FROM t1 WHERE ...
    
    UNION DISTINCT
    
    SELECT * FROM t2 WHERE ...
    

提交回复
热议问题