SQL数据库数据检索top和distinct

一、distinct:针对查询的结果去去除重复(主要针对查询的结果)

  1. top获取前几条数据,top一般都与Order by连用(desc、asc)
  2. distinct去除重复的数据
  3. select distinct Sname from Student
  4. select top 5 * from Student order by tmath desc

二、查询前百分之30%,若不是整数比向上取整

 select top 35 percent * from tableScore order by desc

 

posted @ 2018-06-15 08:45  HPUGIS  阅读(635)  评论(0编辑  收藏  举报