您的位置首页百科词条

vb sql 查询

vb sql 查询

select distinct a,b,c,d from abc order by c descdistinct 关键字 是取唯一值整句意思是 查询 在表abc中按c由大到小排序的 a b c d字段,然后取唯一值如果你用的是sql server的话也可州扮早以用缺穗 top关册雀键字top 1就是显示前面1个 top 2 就是两行select top 1 a,b,c,d from abc order by c desc哦,忘记名字了,有两种方法,一是按名字先分组,然后在排序,另一种就是直接按两个排序1.select top 1 a,b,c,d from abc group by a order by c descselect distinct a,b,c,d from abc group by a order by c desc2.select top 1 a,b,c,d from abc order by a,c descselect distinct a,b,c,d from abc order by a,c desc