PDA

View Full Version : Sorting queries


garoboldy
08-20-2004, 03:39 PM
I am using ODBC with MSSQL server and I run these huge query results but they are never sorted in alpha accending order or decending order..I need to add this into my queries for easier use of finding things.

Also, does anyone have any idea on how I cam implement a system of only showing 10 results per page and what not, I tried the pagination tutorial at phpfreaks but its for mysql and not mssql

THanks for any info everyone.

garoboldy
08-23-2004, 02:27 PM
doesnt anyone have some information on this? I mean I know I'm not the only person thats wanted to do this. :disappointed:

Dean C
08-23-2004, 03:16 PM
To sort by a field in Ascending order you add a statement to your mysql query. Here's an example:


SELECT * FROM table ORDER BY fieldname ASC

rake
08-23-2004, 07:30 PM
To limit the number of results use:

SELECT * FROM table ORDER BY fieldname ASC LIMIT 0,10

where 0 is offset and 10 number of rows