I have point of sale system i am working on. C# and MySQL. As I capture a new sale I want to use two tables namely sale and sale_item.
the sale table has the major details of the sale, whilst the sale_item has the individual products being bought with the actual sale as a foreign key.
On clicking save, How do I create a sale record and immediately get its reference to add it on the sale product.
I thought of select max(saleID)
but there should be a better way to go about it.