Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2009
    Posts
    1

    Unanswered: postgresql timestamp difference

    I've created a small login/logout system.
    So far it works, but now i want to check how many hours a user was loggedin.

    A user can log multiple times in and out on one day.
    how can i determine the minimum AND the maximum timestamp of a day for a specific user?

    The minimum timestamp should be, most of the times, on another row than the maximum timestamp.

  2. #2
    Join Date
    Aug 2009
    Location
    Olympia, WA
    Posts
    337
    This is a poor design choice that unfortunately many fall in to. Put all the data pertaining to a fact on a single row. That will reduce headaches for you and improve performance.

    > how can i determine the minimum AND the maximum timestamp of a day for a specific user?

    That wont satisfy your stated goal. If you reply back that you are obstinate and want an answer not advice, then I'll give you the bullets to shoot your foot.

Posting Permissions

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