How to calculate cost by querying for a particular field in a row
<p>If I have the following data</p>

<pre><code>Cust No.  |  Action       | Val
----------| --------------| ----
10        | Checked out   | 1.0
10        | PAID          | 40.0
10        | Checked In    | 1.0
15        | Flew Away     | 2.0
15        | PAID          | 100.00
15        | Came back     | 1.0
20        | PAID          | 150.00
30        | Checked In    | 1.0
30        | PAID          | 50.00
30        | PAID          | 10.00
</code></pre>

<p>How can I get the <code>SUM</code> of only the <code>PAID</code> values for each customer with a <code>Checked In</code> entry</p>

<p>i.e. </p>

<pre><code>Cust No.  |  Total Paid       
----------| --------------
30        | 60.00
10        | 40.00
</code></pre>