everybody! Could you help me to make SQL query to select unique id and range them in columns by date from 01.01.2018 until 04.01.2018? In my table login has varchar type.
users
id login
-----------------
100 04.01.2018
101 01.01.2018
180 02.01.2018
103 03.01.2018
104 02.03.2018
205 03.01.2018
203 05.04.2018
Required view
01.01.2018 02.01.2018 03.01.2018 04.01.2018
1 1 2 1
I make such query, but it does not work
SELECT COUNT(DISTINCT id) as '01.01.2018' FROM users
where login = '01.01.2018'
union
SELECT COUNT(DISTINCT id) as '02.01.2018' FROM users
where login = '02.01.2018';
union
SELECT COUNT(DISTINCT id) as '03.01.2018' FROM users
where login = '03.01.2018';
union
SELECT COUNT(DISTINCT id) as '06.04.2018' FROM users
where login = '04.01.2018';
I would really appreciate any help and directions!