SELECT 
    t.filename,t.filepath,t.VOTES 
FROM  
    A t 
where 
    not exists(select 1 from A where id=t.id and VOTES>t.VOTES)

解决方案 »

  1.   

    从not exists()子句理解,即输出ID值相同,且不存在Votes比当前记录的Votes值更大的记录。
      

  2.   


    SELECT * 
    FROM T
    INNER JOIN (
    SELECT MAX(Vote) AS Vote, ID
    FROM T
    GROUP BY ID
    ) b ON T.ID = b.ID
      

  3.   

    SELECT id,filename,filepath,votes from A t where votes = (select max(votes) from A id = t.id )
      

  4.   

    select ID,FileName,FilePath,Votes From A where Votes=(select Max(Votes) from A)
      

  5.   

    select top 1 id,filename,filepath,votes from table1 order by votes desc
      

  6.   

    select ID,FileName,FilePath,Votes From A where Votes=(select Max(Votes) from A)
    偶以前也是这样做的。