Task: Text to Code
Input (English): SQL: SELECT DISTINCT cust_name FROM customer ORDER BY acc_bal Asc
Feedback: account balance is wrong . It should be replaced with amount and confirm that customer took a loan .
Output (English): SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id GROUP BY T1.cust_name ORDER BY sum(T2.amount)