Error description: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER by BillingDate DESC' at line 1 SQL: SELECT No, RecordID, DATE_FORMAT(BillingDate,'%M %Y') As RenewalDate, CONCAT('£', FORMAT(AmountBilled, 2)) as AmountBilled, CONCAT('£', FORMAT(AmountPaid, 2)) as AmountPaid, DATE_FORMAT(PaidDate, '%d/%m/%Y') as PaidDate, ELT(PaymentStatus + 1,'Billed','Part Paid', 'Paid','Cancelled','Waived','Written Off') as PaymentStatus from Subscription WHERE No = ORDER by BillingDate DESC