开发者

union is merging results

开发者 https://www.devze.com 2023-01-27 07:30 出处:网络
i have a query that looks as following: (SELECT title FROM pjeducations LIMIT 5) UNION (SELECT title FROM pjeducations WHERE animal != \"all\" L开发者_开发知识库IMIT 5)

i have a query that looks as following:

(SELECT title FROM pjeducations LIMIT 5)
UNION
(SELECT title FROM pjeducations WHERE animal != "all" L开发者_开发知识库IMIT 5)
UNION
(SELECT title FROM pjeducations ORDER BY price DESC LIMIT 5)

Some of the results in the second select are the same as in the first, same with the third select.

The problem is that the duplicate results automaticly get removed but i would like them to stay in it. Anyone know how to achieve this?


Use UNION ALL instead.


Union All 

preserved duplicate results

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号