|
-
Feb 4th, 2010, 11:51 PM
#1
Thread Starter
Member
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
-
Feb 5th, 2010, 12:07 AM
#2
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
-
Feb 5th, 2010, 12:33 AM
#3
Thread Starter
Member
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
-
Feb 5th, 2010, 12:50 AM
#4
Re: Date Order
Sorry for that. See the second post here
Please mark you thread resolved using the Thread Tools as shown
-
Feb 5th, 2010, 06:38 AM
#5
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|