场景:sql server 2008 drop table ID CREATE TABLE ID ( id ,) not null, code int , D date, PRIMARY KEY (id) ) ,getdate()) ,getdate()) ,getdate()) ,getdate()) ,'2017-08-02') ,'2017-08-01') select * from ID 目标: select COUNT(*) from ID group by code 产生code列唯…