Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: dynamic 'Order By'


Message #1 by "Peter Scribner" <plscribner@w...> on Thu, 28 Nov 2002 20:36:49
Jay,

Thanks, that was exactly it. No idea how I missed that.  Thatnks again for 
the help.

Peter

> is this a webpage thing?
<td><a href=3D"showresults.asp?order=3Dlname">Last Name</a></td><td><a =
href=3D"showresults.asp?order=3Dfname">First Name</a></td><td><a =
href=3D"showresults.asp?order=3Dage">Age</a></td>

(results page)

strSQL =3D "select Lname, Fname, age FROM friends orderby " & =
request.querystring("order") & """


Is this what you mean?

Jay

-----Original Message-----
From: Peter Scribner [mailto:plscribner@w...]
Sent: Friday, 29 November 2002 9:37
To: sql language
Subject: [sql_language] dynamic 'Order By'


Hi All,

This has got to be simple.. well, simple if you know the answer:)

I have a SQL statement which initially returns a recordset ordered by =
the=20
users last name.  I want users to be able to re-order the list by any=20
other column by clicking the column title.  I know what I have to do but =
I=20
can't get the syntax right.

The problem is in writing the Order By clause to be dynamic; i.e. to=20
specify the column on which ordering is to be done based on the column =
the=20
user clicked.

How can I replace the .... order by Lname clause with order by (some=20
column name) in the SELECT statement.

Thanks very much for you help - appreciate it.

Peter
---
Change your mail options at http://p2p.wrox.com/manager.asp or=20
to unsubscribe send a blank email to =


  Return to Index