gpt4 book ai didi

mysql - UNION DISTINCT 与 LIMITs

转载 作者:行者123 更新时间:2023-11-29 21:40:26 25 4
gpt4 key购买 nike

有人可以解释一下服务器如何解释该查询吗?

(select * from mytable where <some condition> LIMIT 13)
UNION DISTINCT
(select * from mytable where <some other condition> LIMIT 103)
UNION DISTINCT
(select * from mytable where <some other condition> LIMIT 71) LIMIT 43;

当我尝试时,它返回了 43 行。当我删除最后一个 LIMIT 43 时,它返回了 71 行。

这是否意味着MySQL只考虑最后指定的LIMIT并保持UNION来自每个SELECT的所有DISTINCT行>s直到达到LIMIT?或者它还有什么作用?

最佳答案

p% 还涵盖 p0% 中的所有条目,p0% 还涵盖 p00% 中的所有条目。所以这个查询对我来说并没有什么意义。

我猜 p0% LIMIT 103 返回的行数少于 71 行,因此您得到了 71 行。

关于mysql - UNION DISTINCT 与 LIMITs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34576287/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com