Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting records...

Status
Not open for further replies.

zonash001

Programmer
Mar 10, 2004
15
PK
hi there....

i need some help on sorting records in asp.....here is the scenario....

i've two fields "MonthBilled" and "Amout" stored in an access database.
It contains dummy data as:

MonthBilled Amount
------------- ---------
01-2004 1000
03-2004 800
02-2004 500
12-2003 700

I need to print the above info on an asp page in ascending order (to be sorted on monthbilled field) as:

MonthBilled Amount
------------- ---------
Dec-03 700
Jan-04 1000
Feb-04 500
Mar-04 800

Given below is the query tht i m using....

SQL="Select format(monthbilled, 'mmm-yy') as BillingMonth, sum(amt) as billamt from Billdet where billdet.billid like '"&strBillID&"' group by format(monthbilled, 'mmm-yy') order by format(monthbilled, 'mmm-yy')"

(strBillID = info passed from previous page)

Here is the output generated:
MonthBilled Amount
------------- ---------
Dec-03 700
Feb-04 500
Jan-04 1000
Mar-04 800

Any suggestions??????
 
try this:
Code:
"Select format(monthbilled,'mmm-yy') as BillingMonth, sum(amt) as billamt from Billdet where billdet.billid like '" & strBillID & "' group by monthbilled order by CDate(monthbilled);"

Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top