Run this script:
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;
Why does H2 returns this
-------------------------------
|NB | FINAL |
-------------------------------
|2 | 1-2007-01-01-2007-12-31 |
-------------------------------
instead of
-------------------------------
|NB | FINAL |
-------------------------------
|2 | 1-2007-01-01-2007-12-31 |
| | 2-2007-01-01-NULL |
-------------------------------
?
How should I change my query for having expected result ?