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

Mobile
feeds
Welcome Login | Register

Mysql How To Select Display Last Row Item Retrieve Query SQL From Database
Reply Your Comments:
Click this button if you are interested in replying to this topic and leave your comments
Sent To Friend
CLick this button if you want to send this page to a friend.
Subsribe To Rss Feeds
Subscribe to RSS
CLick this button if you want to subscribe to this RSS Feed. You can use your browsers feeds burners if you have mozilla or internet explorer 7 or higher and keep up with updates.
  Forums Index
      » MYSQL Forums
        » » Mysql How To Select Display Last Row Item Retrieve Query SQL From Database
Mysql How To Select Display Last Row Item Retrieve Query SQL From Database
Post Description: mysql how to select display last row item retrieve query sql from database MYSQL
Post Tags:
This Post Has Been Viewed 4266 Times Since Fri Apr 27, 2007 3:13 pm Author hostman with 10 replies
Mysql How To Select Display Last Row Item Retrieve Query SQL From Database
Advertise On This Page




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


Leave Your Comments

Your Name
Your Email Address (Will Not Be Published)
Notify Me When Someone Replies to this Page
(An email will be sent to you when someone replies to your comments)
Your Comments
Include A Picture with your comments
Share
| More
Share this page by putting this URL in your comments to other websites like myspace, Facebook, Twitter friendster, Hi5, Groups, Boards, Forum or others. Just Copy and Paste this Code
URL:
To embed this topic, just copy the code from the "Embed" box. Once you've copied the code, just paste it into your website or blog to embed it.
Embed:
BBCODE is use on forums. You can put this code on all your BBCODE enabled forums like PhpBB, vBulletin® and others. Just Copy and Paste this code on your Posts and Replies on your forums
BBCODE:
Subscribe Feeds
Webmasters - Exchange Links With Us. Add related websites to this topic
Add Link:
Links Related to : Mysql How To Select Display Last Row Item Retrieve Query SQL From Database

Comments and replies About Mysql How To Select Display Last Row Item Retrieve Query SQL From Database
:: 1 :: Reply #52369 Reply By hmm On Thu May 01, 2008 4:52 pm
hmm:
eee..
but.. how to display 10 last comment ?
:: 2 :: Reply #75111 Reply By fernand On Sun Oct 12, 2008 9:39 am
fernand:
thank you i needed help in using queries to get the last row in a database
:: 3 :: Reply #75115 Reply By wallpaperama On Sun Oct 12, 2008 9:43 am
wallpaperama:
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


:: 4 :: Reply #84793 Reply By lucas On Thu Dec 04, 2008 8:02 pm
lucas:
im intereasted in getting and retrieving last row inserted also How to find last row and last column of table
:: 5 :: Reply #99253 Reply By Lillian On Sat Apr 04, 2009 12:30 am
Lillian:
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.
:: 6 :: Reply #109399 Reply By Alvin On Tue Jul 14, 2009 4:42 pm
Alvin:
thank you very much! it's work :)
:: 7 :: Reply #113382 Reply By kate414 On Fri Aug 21, 2009 7:15 am
kate414:
this works pretty fine when you have an auto-incremented field but how can you get the last row with a varchar field?
:: 8 :: Reply #116670 Reply By Colin On Mon Sep 28, 2009 7:24 am
Colin:
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>
:: 9 :: Reply #125480 Reply By asd On Tue Jan 05, 2010 11:05 pm
asd:
hi bye hi bye hi bye hi bye
:: 10 :: Reply #127770 Reply By Glen On Tue Feb 09, 2010 11:39 pm
Glen:
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