Count distinct value acrross multiple columns
16:33 09 Jan 2018

I constructed table as follows :

SPKID     SPKDate    Engg1   Engg2   Engg3
————————————————————————————————————————————-
123.     2017-01-09       Amy.    Jhon.   

Basically with the table above I want to record working allowance when engineer goes to the field. Each of the spk will consist of maximum 3 engineers. So, I have 3 columns for each engineer.

Now what I am trying to do is count how many times the engineer go each month. And I need to count distinct through multiple columns.

The expected result:

John. 3

Amy. 2

mysql