Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2010

    Unanswered: Creating a timeline


    Can anyone give me some advice on how to create a timeline in sql?

    I work in the nhs and I am trying to create a timeline of clinician's activities. Ideally it will show each minute between the two dates as a row and then count whether the clinican was working that minute (based on the consultation start and end dates).

    So it would be between the @fromdate and the @todate, eg/ 18:00 to 18:02

    and would result something like:

    Time With Patient
    18:00 1
    18:01 1
    18:02 0

    Is this possible? Any help would be greatly appreciated.


  2. #2
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    Ummm... How would we tell when a clinician was with a patient???

    It would help a lot if you could post the CREATE TABLE statements for the tables involved.

    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Jan 2009
    United Kingdom
    As pat Phelan says the DDL and even DML would be useful. What you're trying to do is possible.
    1)Would the consultants times already be in a table? and you're generating reports ?

  4. #4
    Join Date
    Jul 2010
    Thanks for replying. All the needed information is stored on the same table, the consultation table.

    The consultation start date would be con.startdate and the end date is con.enddate. so if the time is between start date and end date of the cosultation then, it would count it as 1.

    I hope this helps. happy to provide further information if needed.

    Thanks again.
    Last edited by mac1984; 07-03-10 at 14:51.

  5. #5
    Join Date
    Apr 2002
    Toronto, Canada
    Quote Originally Posted by mac1984 View Post
    happy to provide further information if needed.
    yes, please indicate which database system you plan to use for this, because you cross-posted the same question in both the SQL Server and MySQL forums | @rudydotca
    Buy my SitePoint book: Simply SQL

  6. #6
    Join Date
    Jul 2010
    The same is now needed for another system, so I have an MySQL and a SQL Server to use.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts