Code
select * from dbo.F_IpToProvince
select code,Provice,substring(ipS,0,charindex('.',ipS,charindex('.',ipS,0)+1)) as ipsShort into ##t1 from dbo.F_IpToProvince
--drop table ##t1
select distinct ipsShort,code,Provice into ##t2 from ##t1
insert into ##t2 select substring(ipE,0,charindex('.',ipE,charindex('.',ipE,0)+1)) as ipsShort,code,Provice from dbo.F_IpToProvince where substring(ipS,0,charindex('.',ipS,charindex('.',ipS,0)+1))<>substring(ipE,0,charindex('.',ipE,charindex('.',ipE,0)+1))
order by ipE
select count(*) from ##t2
select * from ##t2
drop table dbo.##t1
drop table dbo.##t2
posted @
2008-09-10 22:32
laolaowhn
阅读(
154)
评论()
编辑
收藏
举报