DATE_FORMA NOW() mySQL

- Exercise distribution "" Exercise type (parent) desktop exercise actual combat exercise                                                                           
select sum(case when parent_type=0 then 1 else 0 end)'desktop exercise' ,sum(case when parent_type=1 then 1 else 0 end)'actual exercise 'FROM drill_basic;
- drill distribution "" drill type (sub) single drill comprehensive drill    
 select sum(case when child_type=0 then 1 else 0 end)'single drill', sum(case when child_type=1 then 1 else 0 end )'Comprehensive drill' FROM drill_basic; 
- yyyy-dd-01 00:00:00
select DATE_FORMAT(NOW(),'%Y-%m-1 00:00:00') from dual;
- yyyy-dd -31 23:59:59
select DATE_FORMAT(NOW(),'%Y-%m-31 23:59:59')from dual;

Guess you like

Origin blog.csdn.net/hety119/article/details/109815914