0

Suppose this is a Table

Create Table Person(
PersonID varchar(8),
PersonLN varchar(16),
PersonFN varchar(16),
PersonADD varchar(64),
PersonPH varchar(16));

so there are many enrty in that table.. So how to select the lastest row entry from that table? what will be the Mysql statement?

take PersonID as a Primary key..........

9
Contributors
9
Replies
73
Views
11 Years
Discussion Span
Last Post by Anvesh_1
0

Suppose this is a Table

Create Table Person(
PersonID varchar(8),
PersonLN varchar(16),
PersonFN varchar(16),
PersonADD varchar(64),
PersonPH varchar(16));

so there are many enrty in that table.. So how to select the lastest row entry from that table? what will be the Mysql statement?

take PersonID as a Primary key..........

do you have the values?

-2

Just check out this for getting last updated row
<URL SNIPPED>

Edited by peter_budo: Keep It On The Site - Posts must contain actual content and substance and cannot simply be external links.

Votes + Comments
Its a 3 yr old dead thread for god's sake!
0

You can use maxdb_insert_id() For the
Getting last record from table..

Ashish Patel

Edited by Ezzaral: Snipped &quot;fake sig&quot; link. Please restrict such links to your site-wide user signature, which can be edited from the user control panel.

0

SELECT * FROM Person ORDER BY PersonID DESC LIMIT 1

Ashish Patel

Edited by Ezzaral: Snipped &quot;fake sig&quot; link. Please restrict such links to your site-wide user signature, which can be edited from the user control panel.

0

sorry but without an auto-incrementing numerical id, it doesn't look as if sorting will work. It looks like the primary key is PersonID varchar(8),

so id 9a would be rated as a bigger id than id 88888a wouldn't it? That's how it goes with varchar, it's an alphabetical sort, not a numerical one.

How are these varchar ids assigned?? Can they be changed to be auto-incrementing numerical?

And of course this antique thread has been revived by a signature spammer, and the posts should be deleted.

0

hi guys use the following options

SELECT * FROM `myfield` WHERE `trackid` = '65' ORDER BY `id` DESC LIMIT 0,1

if u doesn't need a 'where' check use the following query

SELECT * FROM `myfield` ORDER BY `id` DESC LIMIT 0,1

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.