Wallpapers Forums Login

Mysql How To Select Display Last Row Item Retrieve Query Sql From Database

this Returns the last row from a select where multiple rows in a database table. for example, lets say i have a table called users, and i want to get the last user who registered with the userid as the row. i could use this mysql query:

Code/Command:
$qry = "SELECT * FROM users ORDER BY userid DESC LIMIT 1";
?>


related questions:
How to find last row and last column of table
Retrieving last row inserted
How to select the Last row from a table..using Mysql - MySQL
How to retrieve the last row in MYSQL database using SELECT
xmath279 Sun Sep 12, 2010
Thank you, it really helped much!
That is a great helping site :P
Johnny Mon Apr 19, 2010
Steam from Iceland is putting a damper on my plans to visit New York, Toronto, Reykjavik, London, Paris, and Munich.

I guess I'll just have to solve this MySQL problem.
Jay Mon Mar 22, 2010
how to view the last field of mysql table?
how to view the last field of mysql table?
how to view the last field of mysql table?
Glen Tue Feb 09, 2010
hmm, thats quite easy though it helps for us.
try this..
for mssql

select top 1 * from tblname order by column DESC

or visit this site makeitworth.ph
asd Tue Jan 05, 2010
hi bye hi bye hi bye hi bye
Colin Mon Sep 28, 2009
i had the same problem. i've worked out what i think is a nice solution. check it out at <a href=" colincoderre /mysqlselectlastnrows.php"
title="mysql - select last n rows, by colin coderre"
target="_blank"><b>mysql - select last n rows</b></a>
kate414 Fri Aug 21, 2009
this works pretty fine when you have an auto-incremented field but how can you get the last row with a varchar field?
Alvin Tue Jul 14, 2009
thank you very much! it's work :)
Lillian Sat Apr 04, 2009
i am trying to insert the file name of an image stored on the server into a field in the last row of mysql database. how do i do this? lillian.
lucas Thu Dec 04, 2008
im intereasted in getting and retrieving last row inserted also How to find last row and last column of table
wallpaperama Sun Oct 12, 2008
if you want to select the last 10 rows for example you would use this query:

$sql = "SELECT this FROM users ORDER BY userid DESC LIMIT 0,10";


however, if you want to look for the first 10 rows of userid then you would just change the ORDER to ASC (ascending) like this:
$sql = "SELECT this FROM users ORDER BY userid ASC LIMIT 0,10";


if you have more questions about this tutorial let me know. i am very knowledgable with mysql


fernand Sun Oct 12, 2008
thank you i needed help in using queries to get the last row in a database
hmm Thu May 01, 2008
eee..
but.. how to display 10 last comment ?

Related Content

Information

Share

wallpaperama | Wallpapers | Forums | Terms Of Service

copyright © 2013 wallpaperama - All Rights Reserved - Last Updated Mon May 06, 2013 (-8 GMT)
Powered by: Webune Forums V5