Sqlite别名列给出错误

时间:2016-09-07 12:04:50

标签: mysql sqlite

这是我的表

CREATE TABLE IF NOT EXISTS `calls` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date` timestamp NOT NULL,
  `type` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB

并且有数据

enter image description here

现在我使用此查询获取当天的类型数据

SELECT user.name_first calls.date as days, (SELECT GROUP_CONCAT(type) FROM   calls WHERE DAY(date) = DAY(days) ) FROM calls JOIN user ON user.user_id =  calls.user_id WHERE calls.id IN (SELECT MAX(id) FROM calls GROUP BY  DAY(calls.date))

正如我们所看到的那样calls.date as days并尝试通过

获取此数据的类型
(SELECT GROUP_CONCAT(type) FROM   calls WHERE DAY(date) = DAY(days) )

它在mysql上的工作结果是mysql

enter image description here

但是当我在sqlite上试试它时说

  

没有这样的栏目:天(代码1):,同时编译

我读了sqlite支持别名

0 个答案:

没有答案