View Full Version : simple question (order by)
08-19-2011, 09:47 PM
How do i make the following:
$get_name = mysql_query("SELECT `id`, `name`, `link`, `value`, `description` from `offers` WHERE `countries` like '%us%' LIMIT 0, 25");
How do i make that sort by ID from largest number to smallest number? idk where to put the order by
08-19-2011, 11:02 PM
ORDER BY is always the *last* thing other than LIMIT. (Well, except for some esoteric options you are not likely to ever need.)
To sort from low to high, you use ORDER BY fieldname ASC
To sort from high to low, you use ORDER BY fieldname DESC
Except that ASC is optional, and is the default if DESC is not coded.
Here, read the docs:
08-20-2011, 01:12 AM
as a quick reminder of the syntax order (for most uses)
08-20-2011, 07:52 PM
Ummm...and ORDER BY?
08-21-2011, 02:50 AM
Well yeah i should have included that but you had specifically told the OP where Order By clause went OP. :)
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.