Hi guys so I have the following code that should look at a event cost, figure out from a transaction table if its been fully paid and from that display the unpaid balance. 

```
Select CASESTUDY_CLIENT.CLEINT_FNAME as First_Name,  
       casestudy_client.client_sname as Surname, 
       casestudy_client.client_Phonenumber as Phone_number, 
       casestudy_event.event_totalcost- casestudy_transaction.transaction_value as Unpaid_balance
  from casestudy_client
  inner join casestudy_event
    on casestudy_client.client_id = casestudy_event.event_clientid
  inner join casestudy_transaction
    on casestudy_event.event_id = casestudy_transaction.transaction_eventid
  where casestudy_event.EVENT_EVENTSTAGE ='complete' and 
        casestudy_event.event_totalcost > casestudy_transaction.transaction_value;

```

This works perfectly however if we have a multi part transaction then it fails to pick up the matching event id and assumes its another event. 

In my test data I have an event that costs £500, one transaction that has a value of 400 and one transaction with a value of 99. The current output shows the two records one with an unpaid balance of 100 and the other with 401. What I would like to show is just 99

If this is possible in relatively simple way please let me know as I can't figure out how to make it work