select datepart(week,datefield) as '주차'
,min(convert(char(10),datefield,120)) as '시작일'
,max(convert(char(10),datefield,120)) as '종료일'
,min(case when DATENAME(WEEKDAY,datefield)='일요일' then convert(char(10),datefield,120) end) as '일요일'
,min(case when DATENAME(WEEKDAY,datefield)='월요일' then convert(char(10),datefield,120) end) as '월요일'
,min(case when DATENAME(WEEKDAY,datefield)='화요일' then convert(char(10),datefield,120) end) as '화요일'
,min(case when DATENAME(WEEKDAY,datefield)='수요일' then convert(char(10),datefield,120) end) as '수요일'
,min(case when DATENAME(WEEKDAY,datefield)='목요일' then convert(char(10),datefield,120) end) as '목요일'
,min(case when DATENAME(WEEKDAY,datefield)='금요일' then convert(char(10),datefield,120) end) as '금요일'
,min(case when DATENAME(WEEKDAY,datefield)='토요일' then convert(char(10),datefield,120) end) as '토요일'
from searchTable
where datefield between '2018-01-01 00:00:00' and '2018-12-31 23:59:59'
group by datepart(week,datefield)
order by datepart(week,datefield)
내역이 제대로 들어가있으면 달력이된다.... ㅡ.ㅡ;;
댓글 없음:
댓글 쓰기