来自datetime函数的SQL组合键

时间:2012-04-19 18:54:41

标签: sql sqlite datetime composite-key

我正在尝试使用SQLite的一些函数创建复合键,但是列'newdate'和'newckey'并且在运行查询时显示为空白。有什么建议吗?

SELECT *,
       (repeat||date) as 'ckey', 
       (repeat||newdate) as 'newckey' 
FROM (SELECT transactions.id,
             transactions.repeat,
             transactions.date, 
             datetime(transactions.date,'+'||repeattransactions.interval||' days') 
                   AS 'newdate' 
      FROM transactions, repeattransactions 
      WHERE transactions.repeat = repeattransactions.id
     )

1 个答案:

答案 0 :(得分:0)

SQL本身没有错,日期以错误的格式存储,包括本地时区信息