[PHP] Last 10 rows

2001-04-17 Thread Randy Johnson

How do I get the last 10 rows in a table?

thanks

randy



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Last 10 rows

2001-04-17 Thread CC Zona

In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] ("Randy Johnson") wrote:

 How do I get the last 10 rows in a table?

{select clause} order by {fieldname} desc limit 10

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Last 10 rows

2001-04-17 Thread Rasmus Lerdorf

 How do I get the last 10 rows in a table?

select blah from foo order by something desc limit 10

-Rasmus


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Last 10 rows

2001-04-17 Thread Joe Stump

Well - what is considered the last of the list? Is it a number? are they names?

Either way  you have a field you are ordering by ...

SELECT * FROM table ORDER BY lastname DESC LIMIT 10;

that'll do the trick. FYI you can sort numbers, dates, and chars - this is from
the hip and you might be able to do others ...

--Joe


On Mon, Apr 16, 2001 at 11:53:12PM -0700, Randy Johnson wrote:
 How do I get the last 10 rows in a table?
 
 thanks
 
 randy
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


/* Joe Stump
 * Sr. PHP Developer 
 * http://www.Care2.com http://www.joestump.net http://gtk.php-coder.net
 */


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]