[Solved] How to transform this raw table with SQL?
Here is a way, demo at SQL Fiddle CREATE TABLE Table1 (“id” int, “datetime” time, “name” varchar(1)) ; INSERT INTO Table1 (“id”, “datetime”, “name”) VALUES (1, ’11:10:01′, ‘A’), (1, ’11:10:02′, ‘A’), (1, ’11:10:05′, ‘B’), (1, ’11:12:02′, ‘A’), (1, ’11:12:10′, ‘A’), (2, ’11:13:02′, ‘B’), (2, ’11:13:06′, ‘A’), (1, ’11:14:01′, ‘A’), (1, ’11:14:02′, ‘B’), (1, ’11:14:05′, ‘A’) … Read more