开发者

union is merging results

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜