Sorry for misleading question but I don't know hot to name my issue.
My db<>fiidle is here.
I have a table with defined as follows:
CREATE TABLE shift (
worker_name VARCHAR(25),
log_time DATETIME,
in_out VARCHAR(3)
);
It contains the following data:
INSERT INTO shift VALUES ('User 1', '2018-05-14 07:24:40.000', 'IN');
INSERT INTO shift VALUES ('User 2', '2018-05-14 11:55:29.000', 'IN');
INSERT INTO shift VALUES ('User 3', '2018-05-14 14:03:26.000', 'IN');
INSERT INTO shift VALUES ('User 1', '2018-05-14 14:05:08.000', 'Out');
INSERT INTO shift VALUES ('User 3', '2018-05-14 20:08:30.000', 'Out');
INSERT INTO shift VALUES ('User 2', '2018-05-14 20:08:36.000', 'Out');
INSERT INTO shift VALUES ('User 4', '2018-05-14 20:09:14.000', 'Out');
And as a result I would like to get:
worker_name | IN | OUT
:---------- | :------------------ | :------------------
User 1 | 14/05/2018 07:24:40 | 14/05/2018 14:05:08
User 2 | 14/05/2018 11:55:29 | 14/05/2018 20:08:36
User 3 | 14/05/2018 14:03:26 | 14/05/2018 20:08:30
User 4 | ---------- | 14/05/2018 20:09:14
How can I achieve that?