quecoder Posted March 16, 2008 Share Posted March 16, 2008 HI , I have a bookings table for hotel rooms reservations , a customer makes a reservation , for example , 2 double rooms and 1 family room .. for each room type ( double , family ) I insert one record in bookings that has the room id for this type and quantity ..so , if double room has an ID = 1 , and family ID = 2 , I place the following : booking_id cust_id room_id quantity checkin checkout booking_time Pay_due_amount 1 123 1 2 1205532000 1205618400 1205532000 600 booking_id cust_id room_id quantity checkin checkout booking_time Pay_due_amount 2 123 2 1 1205532000 1205618400 1205532000 600 pay_due_amount is the total payment for both rooms . so every thing is fixed except room_id , quantity . dates are of data type INT , I store the time stamp in them. Question is : when I query for his last five orders in his member area , ((( he may place another order after half an hour and the booking time will be changed for all records for this order ))) , how to distinguish between records and group the ones with same order together , like , to get all data with similar booking_time for that customer ( cust_id) ... is this right ?? and if yes , how to make it? Quote Link to comment https://forums.phpfreaks.com/topic/96386-help-me-in-this-simple-query-please/ Share on other sites More sharing options...
quecoder Posted March 16, 2008 Author Share Posted March 16, 2008 another demonstration: booking_id cust_id room_id quantity checkin checkout booking_time Pay_due_amount 1 123 1 2 1205532000 1205618400 1205532000 600 booking_id cust_id room_id quantity checkin checkout booking_time Pay_due_amount 2 123 2 1 1205532000 1205618400 1205532000 600 And ORDER AFTER some time from the same customer : booking_id cust_id room_id quantity checkin checkout booking_time Pay_due_amount 1 123 2 4 1205532000 1205964000 1205665517 600 booking_id cust_id room_id quantity checkin checkout booking_time Pay_due_amount 2 123 3 2 1205532000 1205964000 1205665517 600 Changes are : room_id , Quantity for every record , but the same booking_time for every record of them ... this may consider unique for each customer because this timestamp is with seconds ...checkin and checkout may not be unique for sure . Quote Link to comment https://forums.phpfreaks.com/topic/96386-help-me-in-this-simple-query-please/#findComment-493313 Share on other sites More sharing options...
quecoder Posted March 16, 2008 Author Share Posted March 16, 2008 the problem has been solved .. thank you Quote Link to comment https://forums.phpfreaks.com/topic/96386-help-me-in-this-simple-query-please/#findComment-493406 Share on other sites More sharing options...
fenway Posted March 17, 2008 Share Posted March 17, 2008 How? Quote Link to comment https://forums.phpfreaks.com/topic/96386-help-me-in-this-simple-query-please/#findComment-493705 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.