mysql any和all的用法


 
1.ANY关键字
假设any内部的查询语句返回的结果个数是三个,如:result1,result2,result3,那么,
select ...from ... where a > any(...);
->
select ...from ... where a > result1 or a > result2 or a > result3;

2.ALL关键字
ALL关键字与any关键字类似,只不过上面的or改成and。即:
select ...from ... where a > all(...);
->
select ...from ... where a > result1 and a > result2 and a > result3;

3.SOME关键字
some关键字和any关键字是一样的功能。所以:
select ...from ... where a > some(...);
->
select ...from ... where a > result1 or a > result2 or a > result3;
 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM