SELECT WHERE ...数百个条件 [英] SELECT WHERE ... hundreds of conditions
本文介绍了SELECT WHERE ...数百个条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有一种优雅的方法来做到这一点:
Is there an elegant way to do this:
SELECT Cols from MyTable WHERE
zip = 90210 OR
zip = 23310 OR
zip = 74245 OR
zip = 77427 OR
zip = 18817 OR
zip = 94566 OR
zip = 34533 OR
zip = 96322 OR
zip = 34566 OR
zip = 52214 OR
zip = 73455 OR
zip = 52675 OR
zip = 54724 OR
zip = 98566 OR
zip = 92344 OR
zip = 90432 OR
zip = 91532 OR
...
(这篇文章中的邮政编码是虚构的,与活着或死去的实际邮政编码没有相似之处)
(zip codes in this post are ficticious and bear no resemblance to actual zip codes living or dead)
推荐答案
是:试试这个 sql 查询.
Yes: Try this sql query.
Select cols from MyTable where zip in (90210, 23310, ... etc.)
这篇关于SELECT WHERE ...数百个条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文