在线等待,这个语句怎么写
create table temp
(aa varchar(100))
go
insert #temp
select 'aa001'
union all
select 'aa002'
union all
select 'bb003'
union all
select 'aa103'
drop table #temp
我想要的结果:当 aa>='aa001'且aa<='aa103'的
时候出现的结果是
aa001
aa002
aa103
下面是关键:
记录的前面的几位不确定
如;aa001,仓库003.仓库006,仓库009
当 aa>=仓库003 且aa<=仓库009
出现:
仓库003
仓库006
仓库009
问题点数:50、回复次数:6Top
1 楼wanyingsong(豌豆)回复于 2004-09-02 16:54:02 得分 15
create table #temp
(aa varchar(100))
go
insert #temp
select 'aa001'
union all
select 'aa002'
union all
select 'bb003'
union all
select 'aa103'
select * from #temp where aa>='aa001' and aa<='aa103'
drop table #tempTop
2 楼zjcxc(邹建)回复于 2004-09-02 16:54:18 得分 15
create table #temp(aa varchar(100))
go
insert #temp select 'aa001'
union all select 'aa002'
union all select 'bb003'
union all select 'aa103'
union all select '仓库003'
union all select '仓库006'
union all select '仓库009'
--查询
select * from #temp
where aa>='仓库003' and aa<='仓库009'
go
drop table #temp
/*--测试结果
aa
-----------------------
仓库003
仓库006
仓库009
(所影响的行数为 3 行)
--*/Top
3 楼zjcxc(邹建)回复于 2004-09-02 16:54:31 得分 5
有问题吗? 不明白。Top
4 楼wanyingsong(豌豆)回复于 2004-09-02 16:55:39 得分 5
是的,不是很明白楼主的意思,呵呵Top
5 楼zlp321002(Life Is Good,Let's Shine)回复于 2004-09-02 16:56:14 得分 10
是啊!楼主建表是不是有问题啊!
create table temp
(aa varchar(100))
go
建了这个表,怎么又用临时表呢!
我没搞明白!!Top
6 楼qiliu(痴心求学)回复于 2004-09-02 17:05:27 得分 0
对不起各位了
我刚才是测试出了问题
sql确实支持这样的区间
唉
以后我一定注意
谢谢各位Top




