Welcome to WebmasterWorld Guest from 54.226.133.245

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Select From Database

     
11:56 am on Sep 21, 2005 (gmt 0)

New User

10+ Year Member

joined:Sept 21, 2005
posts:9
votes: 0


I want and SQL Select Command That

select row where it have the maximam ID

like

select Max(ID) From Table

It will retrieve the maximum ID

but i want to retrieve the whole row

12:04 pm on Sept 21, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 15, 2004
posts:941
votes: 0


hi!
if u need the whole row then u need another query below to select * from Table where ID = '$ID' (which is the one u have just retrieved in the previous query)....u run the query and fetch all remaining data....hope the best..!
12:17 pm on Sept 21, 2005 (gmt 0)

New User

10+ Year Member

joined:Sept 21, 2005
posts:9
votes: 0


Thank You for your replay but there is now a one sql statement
12:27 pm on Sept 21, 2005 (gmt 0)

Full Member

10+ Year Member

joined:Dec 9, 2002
posts:325
votes: 0


Try

SELECT * FROM Table ORDER BY ID DESC LIMIT 1

This has the effect of returning the full contents of 1 row, with the highest (Max) ID.

12:33 pm on Sept 21, 2005 (gmt 0)

New User

10+ Year Member

joined:Sept 21, 2005
posts:9
votes: 0


Thank You

It works correctly

I hope i will help you