question

jfrenzley avatar image
jfrenzley asked

Stored Procedure Help

I am working on a project that is a scheduling system. I have a table with each record being a time slot 12:00, 12:15, 12:30, 12:45.....etc. I have another table that is generated based off code that determines the flow of a product and gives the time that may or maynot be at a specific time slot for scheduling for example lets say 12:06. I want to find the closest time slot. So for 12:06 it should bring back 12:00. How do I accomplish this with a stored procedure?

stored-procedures
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Oleg avatar image Oleg commented ·

@jfrenzley Could you provide some sample data or a bit more details? It looks like you have a table storing time slots meaning that this table has exactly 96 rows (00:00 through 23:45). Is this assumption correct? Please let me know. What about the other table? Does it have the column with data type of time which needs to map to the correct time slot? What about the situation when that value is exactly in the middle? For example, suppose that the time value is 12:07:30. In this case what is the desired matching value from the time slot table? Is it 12:00 or 12:15?

0 Likes 0 ·

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.