This is the SQL I used prior, but at the moment, if there are multiple lines for interest rate in the child, it brings up multiple results for the same debt with the different interest rates
SELECT T2.interest_id,
T1.debt_id AS d_id,
T1.id_user,
T1.debtor AS debtor,
T1.amount AS amount,
T1.repayment as repayment,
T2.interest AS ir
FROM Parent AS T1
INNER JOIN Child AS T2
ON T1.debt_id=T2.debt_id
WHERE T1.id_user='8'
ORDER BY T2.interest DESC
ie it'll list:
50,56,8,Debtor A,1000,50,10.5
54,56,8,Debtor A,1000,50,10.0
53,52,8,Debtor B,5000,100,7.0
even though the date/interest_id of entering 10.0 is after 10.5
I only have a key set on interest_id in the Child table.