select里的between问题
请看下面的查询语句:
select * from userexamandmb where mbid='31' and peipei between '50%' and '100%'
结果是没有记录,但表里是有相应的记录的。这是为什么?
userexamandmb是由两张表组成的视图;字段peipei是varchar类型。在线等!
------解决方案--------------------SQL code
select * from userexamandmb
where mbid= '31' and charindex('%',peipei) > 0 and
cast(left(peipei,charindex('%',peipei)-1) as int) between 50 and 100