我运行了条SQL语句,返回了记录,不太明白,请大家指点select * from (
select 'abc' as d) as a where d between 'a' and 'b'按我的理解,不应该有返回记录值才对呀,请大家讲讲原理
谢谢

解决方案 »

  1.   

    select * from ( 
    select 'abc' as d) as a where d between 'a' and 'b' 有啥问题不?'ABC'是BETWEEN 'A'
    SELECT ASCII('ABC')
    SELECT ASCII('A')
                
    ----------- 
    65(所影响的行数为 1 行)            
    ----------- 
    65(所影响的行数为 1 行)
      

  2.   

    写成这样估计你就容易理解了。
    select * 
    from (select 'abc' as d) as a 
    where d between 'a' and 'b'(select 'abc' as d) as a  产生一个一条记录的结果集。其字段名为 d, 值为 'abc'select * 
    from xxx
    where d between 'a' and 'b'
    'a'<'abc' <'b'
      

  3.   

    select * from (select 'abc' as d) as a where d between 'a' and 'b'
    /*d
    ----
    abc(1 行受影响)*/ 
      

  4.   

    字符串比较是从第一个字符开始依次比较
    a
    abc
    b
    大小顺序是这样的
      

  5.   

    你这个between SQL只会去查询第一个字符,第一个字符刚好在a和b之间。
      

  6.   

    那为什么这2个查询又没有记录返回呢?select * from (
    select 'abc' as d) as a where d between 'a' and 'ab'select * from (
    select 'abc' as d) as a where d between 'a' and 'abb'
      

  7.   

    if 'abc' between 'a' and 'b'
    print 'yes'
    else
    print 'no'/*yes*/
      

  8.   

    select 'abc' as d) as a where d between 'a' and 'abb'abc , abb 哪个大?建议楼主提前前,多少先思考一下。
      

  9.   

    ABC>A不说了
    ABC和AB
    先比较AB,都一样,再比较空和C,空小,所以
    ABC>AB
    下面则是比较
    C和B,所以ABC>ABB