I am working with canteen type of database system and trying to develop stored procedure.
empcode time date item
-------------------------------------------------------------
005153 08:45:03 05/10/2012 12:00:00 AM BREAKFAST ****
005153 08:45:04 05/10/2012 12:00:00 AM BREAKFAST ****
005153 13:48:47 05/10/2012 12:00:00 AM LUNCH
005153 17:40:33 05/10/2012 12:00:00 AM BREAKFAST
The marked records are the area of concern. I want to select only one record out of it. This should be done with respect to the time slots. There are several employees and each having different time slot for breakfast. The selected employee have two slots for breakfast. Therefore it should pick one from one time slot one from another.
The output should be something like this.
empcode time date item
-------------------------------------------------------------
005153 08:45:03 05/10/2012 12:00:00 AM BREAKFAST
005153 13:48:47 05/10/2012 12:00:00 AM LUNCH
005153 17:40:33 05/10/2012 12:00:00 AM BREAKFAST