first I'm using Access database and ole db conn.
I have table Booking :
+------------+--------------+
| no_booking | date_service |
+------------+--------------+
| AN02091701 | 02/09/2017 |
| AN02091702 | 02/09/2017 |
| AN02091703 | 02/09/2017 |
| AN02091703 | 02/09/2017 |
| AN03091701 | 03/09/2017 |
| AN03091702 | 03/09/2017 | ---? find AN03091702
| AN04091701 | 04/09/2017 |
| AN04091702 | 04/09/2017 |
| AN05091701 | 05/09/2017 |
| AN05091702 | 05/09/2017 |
| AN05091703 | 05/09/2017 |
| AN07091701 | 07/09/2017 |
+------------+--------------+
I want make bookingservice ..
i'm using date picker to select date as request member (exactly will be randomly)..
condition that i want --> in one day only have < 4 no_booking
next i try to find the date which have < 4 no_booking to create no_booking automatic.
assumtion that we don't now where the date have < 4 no_booking ...
how to find the top date that contain < 4 no_booking ( the date is 03/09/2017 because have 2 no_booking),
then select the lastindex of no_booking in 03/09/2017 ----> exactly AN03091702 . using fastest query ?
Hope I explain correctly,but sorry about my english ..
Thanks ....
What I have tried:
select no_booking,datebo from booking group by no_booking,datebo having count (datebo) < 3