Im building a very simple trip-booking system. Im used to Filemaker and love the calculation fields it have. Im new at sql and I dont have the brains to figure out this following 2 things:
I have two tables "Trips" and "Bookings"
Trips: ID,MaxSpots,CurrentSpots
Bookings: ID,FK_ID,Spots
I want my customer to be able to click a row in the "Trips" table and be sent to a page that have a form to enter "Bookings" entries. There will be a hidden field "FK_ID that I want the "ID" from "Trips" to be filled in.
How do I check if entered "Bookings.Spots" is bigger than "Trips.CurrentSpots" and then have it calculate and update Trips.CurrentSpots ?