There are 2 tables.(Invoice,Installments). First one is basic details of an invoice.
Invoice table: --------- Invoice_Num Value Down_Payment Balance Customer_name Item_ID Last_Paid_date and etc.
Second is installments of the invoice.
Installment table: --------- Invoice_Num Date Paid Balance ex : Some one bought a laptop on 2015-June-25. Total price 1000$ . He paid 200 $ as down payment. Balance was 800 $ . Then he paid 5 installment like this
Date Paid Balance 2015-July-25 100$ 700$ 2015-Aug-25 100$ 600$ 2015-Sep-10 150$ 450$ 2015-Oct-18 100$ 350$ 2015-Nov-23 120$ 230$ Now I want to update 2015-Nov-23 in first table column name "Last_Paid_date"
I tried this.
update invoice,installment set invoice.last_paid_date=max(date) where invoice.invoice_num=installment.invoice_num group by installment.num There was Syntax error:
java.sql.SQLException: 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 'group by installment.card' at line 1
java.sql.SQLException: 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 'group by installment.card' at line 1