Get the information in terms of time about people who are free on a particular day

  • Hi, I have the following data with me:

    CREATE TABLE Table1 (ID varchar(10),StudentName varchar(30), Course varchar(15) ,SECTION varchar(2),DAY varchar(10),

    START_TIME time , END_TIME time, actual_starttime time, actual_endtime time);

    INSERT INTO Table1 VALUES (111, 'Mary','Science','A','Mon','13:30:00.0000000',16:20:00.0000000','09:00:00.0000000','21:20:00.0000000')

    INSERT INTO Table1 VALUES (111, 'Mary','Maths','A','Tue','12:30:00.0000000',13:20:00.0000000','09:00:00.0000000','21:20:00.0000000')

    INSERT INTO Table1 VALUES (111, 'Mary','Physics','C','Tue','10:30:00.0000000',11:10:00.0000000','09:00:00.0000000','21:20:00.0000000')

    INSERT INTO Table1 VALUES (112, 'Robert','Maths','A','Mon','13:30:00.0000000',16:20:00.0000000','09:00:00.0000000','21:20:00.0000000')

    The scenario is as follows : The student can have class from morning 9 to night 9:30 from Monday to Friday. My requirement is I have to identify a timeslot where all the students in the same section are free so that a teacher

    can reshdule a class. Example: both mary and robert are free since morning 9:00 till 1:30 afternoon on Monday. I would like to write query for this.

    Please help.

  • sindhupavani123 (10/24/2016)


    Hi, I have the following data with me:

    CREATE TABLE Table1 (ID varchar(10),StudentName varchar(30), Course varchar(15) ,SECTION varchar(2),DAY varchar(10),

    START_TIME time , END_TIME time, actual_starttime time, actual_endtime time);

    INSERT INTO Table1 VALUES (111, 'Mary','Science','A','Mon','13:30:00.0000000',16:20:00.0000000','09:00:00.0000000','21:20:00.0000000')

    INSERT INTO Table1 VALUES (111, 'Mary','Maths','A','Tue','12:30:00.0000000',13:20:00.0000000','09:00:00.0000000','21:20:00.0000000')

    INSERT INTO Table1 VALUES (111, 'Mary','Physics','C','Tue','10:30:00.0000000',11:10:00.0000000','09:00:00.0000000','21:20:00.0000000')

    INSERT INTO Table1 VALUES (112, 'Robert','Maths','A','Mon','13:30:00.0000000',16:20:00.0000000','09:00:00.0000000','21:20:00.0000000')

    The scenario is as follows : The student can have class from morning 9 to night 9:30 from Monday to Friday. My requirement is I have to identify a timeslot where all the students in the same section are free so that a teacher

    can reshdule a class. Example: both mary and robert are free since morning 9:00 till 1:30 afternoon on Monday. I would like to write query for this.

    Please help.

    You can easily resolve this by using a calendar table[/url]

    😎

  • Duplicate of http://www.sqlservercentral.com/Forums/Topic1828598-3077-1.aspx#bm1828640

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply