以下提示查询过于复杂,请问有没有什么解决办法?
select * from sale where (shopname='a1' or shopname='a2' or shopname='a3' or ......shopname='a400')
共有400个以上条件
望大侠们帮忙!
select * from sale where (shopname='a1' or shopname='a2' or shopname='a3' or ......shopname='a400')
共有400个以上条件
望大侠们帮忙!
解决方案 »
- 数据库问题
- 有关备份和恢复MS SQL2K数据库登录用户信息(急)
- sql2000,进程数过多的问题,如何设置sql2000属性,来定时删除长时间不工作的进程?
- 怎么写时间sql语句
- 哪位大侠无聊帮忙写几个SQL查询语句啊 别人考试要做的题 SQL 2005的
- C# 存储过程output调用问题,在线等!
- 请大家帮助,如何建立这样的查询??
- SQL多实例连接问题?
- 高人,Delphi的ado+SQLServer出现的问题
- 能不能根据某两个表的关系,(例如xxID=yyID),在另外一个表中建立多个记录,
- 如何让SQL SERVER 2005 登录名不区分大小写?
- 如何用运行access文件连接sql server中的表进行操作
select * from sale where shopname in
(select distinct shopname from sale where id between 1 and 400)
我曾经也碰到类似查询,偶尔一用,先在EXCEL中整理编辑好条件再复制到分析器中执行...
我是把所有店铺先读取到listview1中,店铺名称不会重复,有500个吧.
如果用户要查看所属店铺资料,就在复选柜中把该店铺选择,所以就可以出现同时先择400个店铺了.结果才发现选太多查不了..........
if(selectIndex == -1)return;
stringBuild str = new stringBuild();
str.AppendFomat("select * from sale where shopname={0}",selectItems[0].Tostring());
for(int i=1;i<selectItems.count;i++)
{
str.AppendFomat(" or shopname={0}",selectItems[i].Tostring());
}
感觉用存储过程更好一些。
例如:select 月份,员工编号,员工姓名,部门 from GzItem where
月份]=0 and 员工编号 in (1,2,3,...)这样可以解决我刚刚也是遇到你同样的问题