I have beneficiary which have multiple transactions. On home page I want to show the latest transaction created by the customer. So, latest transaction's beneficiary should come on top with amount details. I have created query something like this. But it doesn't show the latest transaction.
$clause = "SELECT b.*, tran.transfer_amount, tran.date_added as tran_date_added
           FROM beneficiary b
           LEFT JOIN customer_beneficiary_mapping cbm ON b.id = cbm.ben_id
           LEFT JOIN
            (SELECT ben_id, transfer_amount, date_added
             FROM transaction
             GROUP BY ben_id
             ) tran
            ON tran.ben_id = b.id
            INNER JOIN system_country_list scl ON scl.country_id = b.ben_country
            AND cbm.cus_id = '$cus_id'
            ORDER BY tran.date_added DESC
            ";
 
    