Retrieving Last Elevator Passengers With SPL SQL Code
Retrieve MSSQL data, sort by turn. Group by stop, reset cum weight > 1000kg. Get last record's name in each group.
In MSSQL database, data table stores elevator operation records, where turn is the order of a person entering the elevator. The maximum capacity of the elevator is 1,000 kg. There is the capacity limit for the number of passengers it can carry in each stop and the extra passenger(s) need to wait for the next round. We want to get the list of the last passengers entering the elevator in all stops. Write the following SPL code: A1: Retrieve data in SQL and sort data by turn field. A2: Set initial value for the cumulative variable. A3: Group data by each elevator stop. When the cumulative valu...