Data table structure is:
id1,id2,id3,id4,... (some other fields).
I want to create summary query to find out how many times some ID value is used in every column.
Data
1,2,3,4,2008
2,3,5,1,2008
1,3,2,5,2007
1,2,3,6,2007
3,1,2,5,2007
For value 1, the result should be
1,0,0,1,2008
2,1,0,0,2007
How to accomplish this with one query (in MySQL).