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 Coder
    Join Date
    Jan 2004
    Location
    Illinois
    Posts
    72
    Thanks
    2
    Thanked 0 Times in 0 Posts

    MSSQL Sorting Woes

    I'm trying to retrive the top 5 rows of a table based on the column "DateAdded" whose value is supplied via an ASP.NET script when a new row is inserted into the table. Currently when I run the SQL statment all works well except for the fact that it assumes that one digit days are newer than 2 digit days, so:

    It will show 11/5/2008 before it shows 11/12/2008
    11/1/2008 11/20/2008

    here is my current statment:
    Code:
    SELECT     TOP (5) PlaceId, UserId, PlaceName, PlaceLocation, PlacedDateAdded
    FROM         places_table
    ORDER BY PlacedDateAddedDESC
    Last edited by Unknown; 11-11-2008 at 08:26 AM.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    is that column a true datetime column? Or a (n)(var)char column?
    I am the luckiest man in the world


  •  

    Posting Permissions

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