View Full Version : simple question (order by)
08-19-2011, 10: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-20-2011, 12:02 AM
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, 02:12 AM
as a quick reminder of the syntax order (for most uses)
08-20-2011, 08:52 PM
Ummm...and ORDER BY?
08-21-2011, 03: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 © 2015 vBulletin Solutions, Inc. All rights reserved.