Re: [PHP-DB] mysql, finding the last record

2003-09-28 Thread Director General: NEFACOMP
I forgot to add DESC for the ORDER BY clause:
...  ORDER BY SortedColumn DESC LIMIT 1


Thanks
Emery

- Original Message -
From: "Director General: NEFACOMP" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Sunday, September 28, 2003 19:05
Subject: Re: [PHP-DB] mysql, finding the last record


> For the last Auto-increment
> SELECT LAST_INSERT_ID() FROM tblName;
>
> For the last row data:
> SELECT col1, col2, col3, col4 FROM tblName ORDER BY SortedColumn
> LIMIT 1
>
> I don't know what you are looking for exactly.
> Explain and we will try to help though I am not an expert.
>
>
> Thanks
> Emery
> - Original Message -
> From: "Joe Nilson Zegarra Galvez" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, September 26, 2003 19:38
> Subject: Re: [PHP-DB] mysql, finding the last record
>
>
> > if you are seeking for the last in autoincrement field, in your select
use
> > this:
> >
> > select max(field) from table;
> >
> > if is other, well, i dont remember :D
> >
> > Regards
> >
> > Nilson
> >
> > John Ryan dijo:
> > > is there any quick way of selecting the 'last' row in a mysql table??
i
> > > could write some messy code but id prefer an elegant solution.
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
> > -
> > Joe Nilson Zegarra Galvez
> >Sistemas Kola Real
> >  Telefax : 0051-54-256658
> >   Movil: 0051-54-9603244
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] mysql, finding the last record

2003-09-28 Thread Director General: NEFACOMP
For the last Auto-increment
SELECT LAST_INSERT_ID() FROM tblName;

For the last row data:
SELECT col1, col2, col3, col4 FROM tblName ORDER BY SortedColumn
LIMIT 1

I don't know what you are looking for exactly.
Explain and we will try to help though I am not an expert.


Thanks
Emery
- Original Message -
From: "Joe Nilson Zegarra Galvez" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, September 26, 2003 19:38
Subject: Re: [PHP-DB] mysql, finding the last record


> if you are seeking for the last in autoincrement field, in your select use
> this:
>
> select max(field) from table;
>
> if is other, well, i dont remember :D
>
> Regards
>
> Nilson
>
> John Ryan dijo:
> > is there any quick way of selecting the 'last' row in a mysql table?? i
> > could write some messy code but id prefer an elegant solution.
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> -
> Joe Nilson Zegarra Galvez
>Sistemas Kola Real
>  Telefax : 0051-54-256658
>   Movil: 0051-54-9603244
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] mysql, finding the last record

2003-09-26 Thread Joe Nilson Zegarra Galvez
if you are seeking for the last in autoincrement field, in your select use
this:

select max(field) from table;

if is other, well, i dont remember :D

Regards

Nilson

John Ryan dijo:
> is there any quick way of selecting the 'last' row in a mysql table?? i
> could write some messy code but id prefer an elegant solution.
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-
Joe Nilson Zegarra Galvez
   Sistemas Kola Real
 Telefax : 0051-54-256658
  Movil: 0051-54-9603244

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] mysql, finding the last record

2003-09-26 Thread Jason Wong
On Saturday 27 September 2003 01:04, John Ryan wrote:
> is there any quick way of selecting the 'last' row in a mysql table?? i
> could write some messy code but id prefer an elegant solution.

mysql_num_rows()
mysql_data_seek()

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Sometimes when you look into his eyes you get the feeling that someone
else is driving.
-- David Letterman
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] mysql, finding the last record

2003-09-26 Thread John Ryan
is there any quick way of selecting the 'last' row in a mysql table?? i
could write some messy code but id prefer an elegant solution.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php