Results 1 to 5 of 5

Thread: Date Order

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2009
    Posts
    58

    Date Order

    Dear Experts

    Table1 has following data

    date----------weight
    14/01/2010------5
    14/01/2010------10
    15/01/2010------20
    02/02/2010------35

    I use followin query

    Code:
    str = "SELECT RANK() OVER(ORDER BY date) AS sno ,date, SUM(weight) AS weight FROM table1  GROUP BY Date"        dt = GetTable(str)str = "SELECT RANK() OVER(ORDER BY date) AS sno ,date, SUM(weight) AS weight FROM table1  GROUP BY Date order by date"
            dt = GetTable(str)

    The query generates these results

    1----02/02/2010------35
    2----14/01/2010------15
    3----15/01/2010------20

    This is not order by date as you can see
    I want to display data index on date order as

    1----14/01/2010------15
    2----15/01/2010------20
    3----02/02/2010------35

    Please help

  2. #2
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Date Order

    Apply the Desc keyword to the sort list as

    Code:
    SELECT RANK() OVER(ORDER BY date) AS sno ,date, SUM(weight) AS weight FROM table1  GROUP BY Date Order by Date desc
    Please mark you thread resolved using the Thread Tools as shown

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2009
    Posts
    58

    Re: Date Order

    sorry sir,

    your method does not work

    following result are displayed by add DESC at the end of query

    1----02/02/2010------35
    2----15/01/2010------20
    3----14/01/2010------15

    but i want these results

    1----14/01/2010------15
    2----15/01/2010------20
    3----02/02/2010------35

  4. #4
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Date Order

    Sorry for that. See the second post here
    Please mark you thread resolved using the Thread Tools as shown

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Date Order

    Moved To Database Development

Posting Permissions

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



Click Here to Expand Forum to Full Width