» Quick Links
You can make money on these forums
We Share profits with you
Google
Google Adsense
Google Adwords
YPN
Yahoo
MSN Search
Web Directories
Web Hosting
Web Hosting Offers
Hosting News
Suggestions
Link Building
Domain Names
PHP Forums
MySQL Forums
» More Links
OSP News
Reseller Hosting
Shared Hosting
Dedicated Servers
Google Adsense
Search Engine Marketing
Link Development
Affiliate Marketing


» Advertising
Multiple DC PR Check

Free SEO Tools


Go Back   Webmaster Forums > Website Developement / Programming > ASP forums and Tips

ASP forums and Tips Talk about ASP Scripting. .net and Cold Fusion as well.

Reply
 
Thread Tools Display Modes
  #1  
Old 08-24-2006, 02:25 PM
kinsley kinsley is offline
OSP Starters
 
Join Date: Aug 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
kinsley is on a distinguished road
Default ORDER BY a column?

Hello all,

If I have several fields:
a | b | c | d | e

and the original SQL = SQL & " ORDER BY a ASC ".

I want to place links to b, c, d, e to make the table of results to show by ascending order of b (or , c, d, e).

do I need to place an "if/ end if" in the sql or do I put some statement in the paging?

example
a (ORDER BY a ASC)| b | c | d | e
1 | 3 | z
2 | 2 | y
3 | 1 | x
4 | 5 | w
5 | 4 | v

to

a | b (ORDER BY b ASC)| c | d | e
3 | 1 | x
2 | 2 | y
1 | 3 | z
5 | 4 | v
4 | 5 | w

Thanks in advance -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Revenue Sharing Ads ( ?):
  #2  
Old 08-24-2006, 02:28 PM
invincible invincible is offline
OSP Starters
 
Join Date: Apr 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
invincible is on a distinguished road
Default

Use a querystring

dim vOrderBy, strSQL

vOrderBy = ""
vOrderBy = request.querystring("ob")

strSQL = ""
strSQL = "SELECT * from tab_Whatever ORDER BY "&vOrderBy&" "

Your links would be <a href="link.asp?ob=a">Link</a>

Or you could even put little Up/Down arrows at the top of each column and then pass an ASC or DESC

Dim vOrderBy, vOrder, strSQL

vOrderBy = ""
vOrder = ""
strSQL = ""

vOrderBy = ""
vOrderBy = request.querystring("ob")

vOrder = ""
vOrder = request.querystring("o")

Select case vOrder
Case "a"
vOrder="ASC"
Case "d"
vOrder="DESC"
End Select

strSQL = " -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
posting more in order to access forums dhaliwal Suggestions & Feedback 8 06-01-2008 11:54 AM
1054 Unknown column.... Worlord MySQL Forums 1 03-09-2007 08:32 AM
Creating a column.... refik MySQL Forums 1 12-18-2006 03:44 AM
cancelling the order!! twist Web Hosting Industry 1 10-12-2006 02:54 AM
Welcome to order carisoprodol on OutSourcingPlans... osp Introductions 0 08-13-2006 10:27 PM


All times are GMT. The time now is 02:17 AM.