有这么一个表:
 id   |  name  |   age   |   item
  1   |  tom  |   12    |    1
  2   |  cat  |  23     |    2
  3   | ...   |  36   |      3
  4   | ...   |  15    |     4
  5   | ...   |  26    |     2
  6   | ...   |  16    |     1.......找出 item=3的age 且 其他age小于item=3的age

解决方案 »

  1.   

    找出 item=3的age 且 其他age小于item=3的age很好,很强大的要求,一个字都没看懂!
      

  2.   

    看完我就迷糊了,哈哈哈,果子,看完你回的,我实在忍不住,这要求笑死我了~~咬文嚼字半天~~,楼主是不是要把item<=3的age查出来呀??
      

  3.   

    select * from 表名 where item=3 and age<ALL(select age from 表名 where item=3);
      

  4.   

    ...楼主意思是不是 找出item=3的 age最小的那条数据?先取出item=3 再按年龄升序 取第一条 
      

  5.   

    select age from 这个表名  where item <=3;
    你的表达能力实在不是一般..不过我非常人...
      

  6.   

    4楼说的是不是这样可以实现
    select top 1 * from  表名 where item=3 group by age desc
      

  7.   

    终于看懂意思了. 你是要找出item=3的age然后在找出比item=3这条数据的age字段小的  age
    select * from where age <(select age from 表名 where item=3);你的数据只有一条item=3的,如果后面的结果有两条不同的数据.你可以试试select * from 表名 where age <ALL(select age from 表名 where item=3);
      

  8.   


    对不起大家了,我的语言表达能力问题:
    除开item为3的,意思是以item为3的作为参考(但是要排开item为3的),求出其他列里的岁数比item为3的age小的
      

  9.   

    其实就是一个除法操作,我忘记sql的除法怎么用了,
      

  10.   

    select * from 表名 where item=3 and age <ALL(select age from 表名 where item=3);
    可行
      

  11.   

    SELECT * 
    FROM   表名
    WHERE  item=3 AND age<(SELECT age
                            FROM   表名 
                            WHERE  item=3)试下这个,能行