sql distinct 用法

来源:互联网 发布:无限量流量软件 编辑:程序博客网 时间:2024/05/20 14:18

  select     COUNT(distinct  Name) from Door  group by ID,Name

 select     DoorID,  DoorName ,COUNT(distinct DoorName) from Door group by ID,Name


distinct  会有损耗性能问题,不过有个前提是数据量够大,100万级别以上


group by  好些

 

                                       
                                       





原创粉丝点击