Re: Get next data set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Merlin wrote:
Hi there,

I am trying to figure out how to write a sql statement for mysql with php that returns the next possible data set. For example I do have the ID number of a current data set, now I would like to retrieve the next data set with the next higher ID number. Sometimes there are deleted Ids, thats why one cant just increment the data ID.

Here is how I tried it:
$stmt =" SELECT
g.place
FROM
$T33 g
WHERE
g.ID < $prev[id]
LIMIT 1
";


That unfortunatelly returns the very first row in the table.

Any ideas how to solve that?

Thanx for any help,

Merlin

got it :-)

		ORDER BY ID desc
		LIMIT  1

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux