运行此脚本:
drop table if exists foo cascade;
create table foo(
id int NOT NULL auto_increment,
start date NOT NULL,
end date
);
insert into foo(start,end) values('2007-01-01', '2007-12-31');
insert into foo(start,end) values('2007-01-01', NULL);
SELECT
COUNT(*) nb,
GROUP_CONCAT(
id || '-' || start || '-' || end
SEPARATOR CHAR(10)
) final
FROM
foo;
为什么 H2 会返回这个
-------------------------------
|NB | FINAL |
-------------------------------
|2 | 1-2007-01-01-2007-12-31 |
-------------------------------
代替
-------------------------------
|NB | FINAL |
-------------------------------
|2 | 1-2007-01-01-2007-12-31 |
| | 2-2007-01-01-NULL |
-------------------------------
?
我应该如何更改我的查询以获得预期的结果?