It would be a lot easier if your dates were stored in the table in DATETIME columns.The best way with what you have will be to convert the columns to DATETIME on the fly. You can use this function:create function MDate (@Year int, @Month int, @Day int)returns datetimeasbeginreturn dateadd(day,@Day-1,dateadd(month,((@Year-1900)*12)+@Month-1,0))endgo
Then your query would be something like this:SELECT *FROM appointments WHERE MDate (start_year,start_month,start_day) between MDate ($start_year,$start_month,$start_day) and MDate ($end_year,$end_month,$end_day)ORDER BY start_year, start_month, start_day, start_time ASC
CODO ERGO SUM