select * from Table1 where ID between 1 and 200 and charindex('w',Name)>0 order by age
select * from Table1 where ID >=1 and ID<= 200 and charindex('w',name)>0 order by age
ID字段第1到200, 你的ID是按照数字排序吗?如果是的话1楼就可以了如果不是的话,那就麻烦了select top 200 * to # from table1 select * from # where charindex('w',Name)>0 drop table #
哦,忘记排序了, select top 200 * to # from table1 select * from # where charindex('w',Name)>0 order by age asc drop table #
ID字段中的第1-200条记录,我的理解就是前200条纪录select * from (select top 200 * from Table1 order by uid)tmp where name like '%w%' order by age以前不知道charindex函数 随便问一下用 like 关键字和用 charindex 那个效率高一点 谢谢!
select * from Table1 where ID between 1 and 200 and name like '%w%' order by age
select * from Table1 where (ID between 1 and 200) and name like '%w%' order by age
order by age
order by age
select * from #
where charindex('w',Name)>0 drop table #
select top 200 * to # from table1
select * from #
where charindex('w',Name)>0
order by age asc
drop table #
(select top 200 * from Table1 order by uid)tmp
where name like '%w%' order by age以前不知道charindex函数
随便问一下用 like 关键字和用 charindex 那个效率高一点
谢谢!
order by age
where (ID between 1 and 200)
and name like '%w%'
order by age