How to get Same Second or less than 10 Second record and Same Location Record in SQL Server

  • Hi.. I need to get records having Same datetime but can have second difference of 10 Seconds and has same location in SQL Server .. Pls help me on this...

    DATETIME ADMITID LOCATION

    --------------------------------------------------------

    7/29/2012 00:01:4011F-E FRONT IN

    7/29/2012 00:01:5421F-E FRONT OUT

    -----------------------------------------------------------------

    7/29/2012 00:01:551CHEN DLF 1 IN

    7/29/2012 00:01:581CHEN DLF 1 IN

    ----------------------------------------------------------------------SAME LOCATION AND SAME DATE and -------------------------------------------------------------------------TIME and SECOND DIFFERENCE should -------------------------------------------------------------------------get Displayed as above and below records

    7/29/2012 00:02:181CHEN-DLF IN

    7/29/2012 00:02:201CHEN-DLF IN

    ---------------------------------------------------------------------

    7/29/2012 00:03:061BLR-WF-ITSVC-3F-NORTH(ENTRY)

    7/29/2012 00:03:102BLR-WF-ITSVC-2F-SOUTH(EXIT)

  • Hello and welcome to ssc. Please read the link in my signature block, this will show you how to set up and post scripts for sample data. You're far more likely to get help if you do this, sometimes folks will do it for you.

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

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

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