从 datetime 对象中提取月份,然后在 CASE 语句中使用它。
以此为基础
select
case strftime('%m', date('now'))
when '01' then 'January'
when '02' then 'Febuary'
when '03' then 'March'
when '04' then 'April'
when '05' then 'May'
when '06' then 'June'
when '07' then 'July'
when '08' then 'August'
when '09' then 'September'
when '10' then 'October'
when '11' then 'November'
when '12' then 'December' else '' end
as month
我建议复制表的架构,为该月添加另一列。然后使用以下语句。
INSERT INTO TABLE newTable (col1, col2, col3, ..., colLast, colMonth)
SELECT col1, col2, col3, ..., colLast,
case strftime('%m', date('now'))
when '01' then 'January'
when '02' then 'Febuary'
when '03' then 'March'
when '04' then 'April'
when '05' then 'May'
when '06' then 'June'
when '07' then 'July'
when '08' then 'August'
when '09' then 'September'
when '10' then 'October'
when '11' then 'November'
when '12' then 'December' else '' end
as colMonth
FROM oldTable;
然后
drop table oldTable;
然后
Some alter to change the name of the new table to the name of the old table.