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