SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Non-Member
    Join Date
    Aug 2007
    Posts
    494
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Query SELECT and exclude rows

    Hi all.

    I have this query:

    Code:
    SELECT * FROM
    myTable
    ORDER BY DATE DESC
    The result of this query is:

    17/08/2008
    17:11:38
    CERTALDO
    BOSCO

    17/08/2008
    16:58:01
    CERTALDO
    BOSCO

    17/08/2008
    15:05:27
    CERTALDO
    BOSCO

    17/08/2008
    14:48:31
    CERTALDO
    BOSCO

    17/08/2008
    14:43:38
    CERTALDO
    BOSCO

    17/08/2008
    09:43:56
    SUBBIANO
    CAPOLONA

    17/08/2008
    00:16:13
    ROSIA
    DOCCIO
    But I need exclude the rows when are the same and when the time difference is less than 60 minutes.

    The result of the query should be:

    17/08/2008
    16:58:01
    CERTALDO
    BOSCO

    17/08/2008
    14:43:38
    CERTALDO
    BOSCO

    17/08/2008
    09:43:56
    SUBBIANO
    CAPOLONA

    17/08/2008
    00:16:13
    ROSIA
    DOCCIO
    Removing this rows:

    17/08/2008
    17:11:38
    CERTALDO
    BOSCO

    17/08/2008
    15:05:27
    CERTALDO
    BOSCO

    17/08/2008
    14:48:31
    CERTALDO
    BOSCO
    Because are less than an 60 minutes compare previous record... therefore within an hour only the oldest.

    It's possible?
    Thanks
    Viki

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,085
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    It is possible
    You have to join the table with itself

  3. #3
    Non-Member
    Join Date
    Aug 2007
    Posts
    494
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks x your answer, but I dont understand your suggestion.

  4. #4
    Non-Member
    Join Date
    Aug 2007
    Posts
    494
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any idea?


Bookmarks

Posting Permissions

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