Lets see if I understood you at all 🙂
You have a database with a table that contains days as columns, so something like
sun | mon | tue... etc
and names as rows, so it's like
sun | mon | tue ...
john| peter| Karl ...
Bert| John | karl ...
And you want to know how many colums there are with the name John in it, and how many with the name karl etc...?