title: Sum weights based on other rows values
body: <p>i'm looking for a query to sum the weights (from the first row -> q17), for every row (every question), but based on the answers of other questions. the idea is to leave out the value from the sum, if the answer does not have a value within other questions. </p>
  
  <p>example</p>
  
  <pre><code>q17 5   5   4   3   5   5   4   5   =   36  for q17
  q18 4   2   3   2   5   4   1   4   =   36  for q18
  q19 5   2   4   2   5   4   1   4   =   36  for q19
  q20 4   2   5   3   5   4   1   4   =   36  for q20
  q21 4       5   3   5   5   1       =   26  for q21
  q22 4   2   4   2   4   4   1   4   =   36  for q22
  q23 4   1   4   3   5   4   1   4   =   36  for q23
  q24 4   1   4   1   5   3   1   4   =   36  for q24
  q25 5   2   4   3   5   4   1   4   =   36  for q25
  q26 5   4   5   3   5   5   5   5   =   36  for q26
  q27 5   4   4   1   5   4   1   4   =   36  for q27
  q28 4   1   5   2   5   5   1   4   =   36  for q28
  q29 5   5   5   4   5   4   5   5   =   36  for q29
  q30 4   2   3   2   5   4   1   4   =   36  for q30
  q31 4   3   4   4   5   4   1   5   =   36  for q31
  q32 4   1   4   1   5   4   1   4   =   36  for q32
  </code></pre>
  
  <p>the weights are at q17. and i need to calculate the weights for every question. but where a question isn't answered, i don't need to sum into the weights.</p>
  
  <p>don't take q18-32 as values, just take them only as true/false if it has a value or not for the question then sum the weights from q17 based on this for every q.</p>
  
  <p>the data is the following</p>
  
  <pre><code>Q   A
  17  5
  18  4
  19  5
  20  4
  21  4
  22  4
  23  4
  24  4
  25  5
  26  5
  27  5
  28  4
  29  5
  30  4
  31  4
  32  4
  17  5
  18  2
  19  2
  20  2
  22  2
  23  1
  24  1
  25  2
  26  4
  27  4
  28  1
  29  5
  30  2
  31  3
  32  1
  17  4
  18  3
  19  4
  20  5
  21  5
  22  4
  23  4
  24  4
  25  4
  26  5
  27  4
  28  5
  29  5
  30  3
  31  4
  32  4
  17  3
  18  2
  19  2
  20  3
  21  3
  22  2
  23  3
  24  1
  25  3
  26  3
  27  1
  28  2
  29  4
  30  2
  31  4
  32  1
  17  5
  18  5
  19  5
  20  5
  21  5
  22  4
  23  5
  24  5
  25  5
  26  5
  27  5
  28  5
  29  5
  30  5
  31  5
  32  5
  17  5
  18  4
  19  4
  20  4
  21  5
  22  4
  23  4
  24  3
  25  4
  26  5
  27  4
  28  5
  29  4
  30  4
  31  4
  32  4
  17  4
  18  1
  19  1
  20  1
  21  1
  22  1
  23  1
  24  1
  25  1
  26  5
  27  1
  28  1
  29  5
  30  1
  31  1
  32  1
  17  5
  18  4
  19  4
  20  4
  22  4
  23  4
  24  4
  25  4
  26  5
  27  4
  28  4
  29  5
  30  4
  31  5
  32  4
  </code></pre>