一步搞定!(其中tmp表为任何具有连续ID的超过366条记录的表,即从未删除记录的表)
drop table if exists a;
create table a as select date('now','start of year','+'||(rowid-1)||' day') date, (rowid-1)/7+1 type,(rowid-1)/7+1 week from tmp order by rowid limit 366;
update a set type=case type when 4 then 1 when 19 then 1 when 20 then 1 when 23 then 1 else 2 end;
追问谢谢高手。希望大神能逐条解释一下这个SQL语句~
追答呵呵,本次问题已经回答完毕