本文介绍了如何在使用SQL Server的条件中给出更多值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的所有人, 我有一个十万的政策,我必须一次为所有一万个政策选择数据。如何通过使用sql server查询来完成这项工作。 例如, 从政策中选择* 其中policy_no in(1,2 ,3,4,..... 100000)。 请帮我解决这个问题。 我的尝试:
Dear All, I have one lakh policy nos, I have to select the data for all one lakh policies at a time. How can i get this done by using sql server query. For example, select * from policy where policy_no in (1,2,3,4,.....100000). Please help me to resolve this issue. What I have tried:
Dear All, I have one lakh policy nos, I have to select the data for all one lakh policies at a time. How can i get this done by using sql server query. For example, select * from policy where policy_no in (1,2,3,4,.....100000). Please help me to resolve this issue.推荐答案
如果允许的政策号码不是范围(从1到X) )然后我会建议为允许的数字创建一个表并在查询中使用它。 例如 表AllowedPolicyNo If the allowed policy numbers is not a range (from 1 to X) then I would suggest creating a table for allowed numbers and using that in your query. For example Table AllowedPolicyNo - 1 - 15 - 18...
和查询
And the query
select * from policy p where p.policy_no in (select apn.policy_no from allowedpolicyno apn).如果您愿意,可以使用连接
Or you can use a join if you prefer that
检查一下: SQL Server 2012 - 分页介绍 [ ^ ]
更多推荐
如何在使用SQL Server的条件中给出更多值
发布评论