I have these tables:
client
- idclient
- name
- reference
address
- idaddress
- idclient
inv
- idinvoice
- idaddress
- datetime
- total
payment
- idpayment
- idinvoice
- pdatetime
- amount
into - name, reference, time, idpayment, idinvoice, amount
i.e. datetime and pdatetime as time. inv.total as negative amount. Where idaddress = 9