Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SQl Query for Top and Bottom Row value for the particular date

    I want to select First value and Last value for the particular date and Id

    Table Ex.

    ID DATE VALUE
    001 23:04:2009 APPLE
    001 23:04:2009 GRAPHE
    001 23:04:2009 ROSE
    001 24:04:2009 BERRY
    001 24:04:2009 TIFFANY
    001 24:04:2009 ORGANE
    001 24:04:2009 SILVER


    FOR 001 VALUE NEEDED –

    APPLE AND ROSE FOR THE DATE OF 23:04:2009
    BERRY AND SILVER FOR THE DATE OF 24:04:2009

    Result Expected:

    ID DATE VALUE
    001 23:04:2009 APPLE
    001 23:04:2009 ROSE
    001 24:04:2009 BERRY
    001 24:04:2009 SILVER


    I tried Min, max, top condition but I am not getting a proper answer

    SQL QUERY HELP urgent

  • #2
    New to the CF scene
    Join Date
    Jul 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Select first(n) or last(n) rows from a table

    you can use
    select top 1 <columnname> from <tablename>
    or
    select bottom 1 <columnname> from <tablename>

    hope it works !


  •  

    Tags for this Thread

    Posting Permissions

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