select * from price where pid>‘2000’ and pid not like '%55%'
select * from ( select * from price where pid not like '%*%' )a where convert(int,a.pid)>2000
都不行 还是上面的错啊 是like '%*%' 因为数据不准确就会出现 *55* *35*这种问题
select * from price where pid>'2000' and pid not like '%55%'
select * from ( select * from price where pid not like '%*%' )a where convert(int,a.pid)>2000 这样会报错 select * from price where pid>'2000' and pid not like '%55%' 这样不是想要查询的结果 pid>'2000' 和 pid>2不同 pid是varchar类型的
select * from price where pid>right('00000000' + '2000',8) and pid not like '%55%'
[Quote=引用 9 楼 fajangsi 的回复:] select * from ( select * from price where pid not like '%*%' )a where convert(int,a.pid)>2000 这样会报错把错误贴出来,我看一下
在将 varchar 值 '**45' 转换成数据类型 int 时失败。
不行 还是原来的错误
(
select * from price where pid not like '%*%'
)a
where convert(int,a.pid)>2000
是like '%*%' 因为数据不准确就会出现 *55* *35*这种问题
select * from price where pid>'2000' and pid not like '%55%'
(
select * from price where pid not like '%*%'
)a
where convert(int,a.pid)>2000 这样会报错 select * from price where pid>'2000' and pid not like '%55%'
这样不是想要查询的结果 pid>'2000' 和 pid>2不同
pid是varchar类型的
select * from
(
select * from price where pid not like '%*%'
)a
where convert(int,a.pid)>2000 这样会报错把错误贴出来,我看一下