Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
issuee
Starting Member
1 Post |
Posted - 2014-03-15 : 19:23:12
|
I have made 3 charts in phpmyadmin.t1 = departure , 7column (flight, from, to, date, Place, price and left)t2 = booking , 6column (flight, id, Agency, number, booked, payed)t3 = debt , 3column (angecy, sum, credit)When a customer of a travel agency book a number of places on a specific plane (flight) performs a transaction thatreduce the number of places (left) with current number (UPDATE .. SET ... WHERE).I stuck with this question, is there anyone who can explain more about it ? thanks |
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2014-03-17 : 12:31:13
|
I assume your question is about how to write the UPDATE statement?I don't know how you are handling how many seats are being reserved. Meaning do you have a new total or just the number attempting to be reserved. If you have a number of seats you want to reserve, you can just subtract them:UPDATE departure SET left = left - <number of new reserved seats>WHERE flight = <flight> But, I suspect that it is more complicated than that as you would need verify that you haven't oversold (given a real airline that probably isn't an issue). That requires more logic and other things (like locking hints) in order to be consistent. |
 |
|
|
|
|
|
|