I am stuck in a situation wherein I have to insert id in sql table based on another particular value in another table.
For example: I have one table say bookings with column invoice_number and another table say invoice_hotels with column invoice_id.
I am trying to insert invoice_id in invoice_hotels based on data in invoice_number column of bookings table.
I want to achieve below functionality also use MySQL squery only not PHP
- If Last value in invoice_number column of bookings table is 9000 then I want to insert 9001 in invoice_id column of invoice_hotels
I know this can easily be done through PHP script but I am trying to do it with sql only.
I have referred this and this but didn't understood how to use it.