使用函数Year及CurDate的组合: Year(CurDate())
select date_format(min(date),'%Y-%m-%d') as mindate, date_format(max(date),'%Y-%m-%d') as maxdate, weekofyear(date) as weekyear, format(sum(hours),2) as sumhours from daywork where userid='myid' and date_format(date,'%Y')=Year(CurDate()) group by weekyear order by weekyear
本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/xiandedanteng/p/5681305.html,如需转载请自行联系原作者