Current location - Recipe Complete Network - Catering industry - SQL statement, in the restaurant industry, to take different rates for different time periods
SQL statement, in the restaurant industry, to take different rates for different time periods
This is not recommended to use SQL, use SQL if the price change will not be good to modify, it is better to realize in the program

If you have to use that, then use CASE statement to judge it, or use IF statement

SELECT Price = CASE Time WHEN Time >= 8:00 and Time < 10:00 THEN 5

WHEN time>= 10:00 and time< 12:00 THEN 10

WHEN time>= 20:00 and time< 22:00 THEN 50 END

FROM table name