The below MySQL table looking something like this below.
consulted_on (DATE) consulted_by (VARCHAR)
---------------------------------------------
04/12/2018 Mr.Bob
04/12/2018 Mr.Jhon
04/12/2018 Mr.Bob
05/12/2018 Mr.Jhon
06/12/2018 Mr.Bob
06/12/2018 Mr.Jhon
07/12/2018 Mr.Bob
I would like to display the data as below , Is it possible to get the output like below ?
consulted_on(DATE) Mr.Bob Mr.Jhon
-------------------------------------
04/12/2018 2 1
05/12/2018 0 1
06/12/2018 1 1
07/12/2018 1 0
The consulted_by column is basically contains dynamic value, in this case how do I write pivot query in mysql ? can any one help me with this ?
Many Thanks