摘要: 以前碰到的一个表,存储时间按照周为单位存储,而却需要按照天为单位使用。为了减少程序复杂度,便增加了多层查询,提高Sql查询结果可用性。select (week_no-week_start)*7+week_day-week_day_start pp, dateadd(day,(week_no-week_start)*7+week_day-week_day_start,Month) the_day, * from ( select case DatePart(w,Month) when 7 then 1 else DatePart(w,Month)+1 end as week_day_start, 阅读全文
posted @ 2011-01-25 23:49 dzqabc 阅读(315) 评论(0) 推荐(0) 编辑