表结构如下字段1    字段2    字段3
-----------------------
1         a    
1         b
2         a
2         b
2         c
3         a
3         b
3         c
-----------------------
我只想得到字段1的最大值的所有记录,sql语句应该怎么写?

解决方案 »

  1.   

    select * from tb where 字段1=(select top 1 字段1 from tb order by 字段1 desc)
      

  2.   

    select * from [TableName] where [字段1] = (select max([字段1]) from [TableName])
      

  3.   

    langmafeng(乞力马扎罗) 说的对
      

  4.   

    select * from tb where 字段1=(select max([字段1])  from tb)
      

  5.   

    select * from [table] where 字段1=(select top 1 字段1 from [table] where order by 字段1desc)
      

  6.   

    select * from [table] where 字段1=(select top 1 字段1 from [table] where order by 字段1desc)select * from tb where 字段1=(select max([字段1])  from tb)他们写的两种方法都可以!
      

  7.   

    select MAX(字段1) from [table]
      

  8.   

    呵呵,看错问题了
    select * from [table] where 字段1=(select max(字段1)  from [table])
      

  9.   

    表结构如下字段1    字段2    字段3
    -----------------------
    select * from table where 字段1 in(select distinct(max(字段1)) from table);
      

  10.   

    select 字段1 from TableName where  字段1= (select  max([字段1]) from TableName)