SELECT FROM表WHERE lastupdated =最近更新

时间:2013-10-23 07:11:28

标签: php mysql select timestamp

如何从表中选择最近更新的行。 我的语法似乎错了。

<?php 
require_once 'db_conx.php';
$Result = mysql_query("SELECT * FROM  'table' WHERE lastupdated('timestamp') = CURDATE()")      or die (mysql_error());
while($row = mysql_fetch_array($Result))
{
echo $row['name'] . "" .$row['phoneno'];
}
mysql_close($con);
?>

2 个答案:

答案 0 :(得分:2)

如果您需要上次更新的最新记录,那么您可以 试试这个::

SELECT * FROM  'table' order by lastupdated desc limit 1

答案 1 :(得分:0)

试试这个..

SELECT * FROM  'table' ORDER BY lastupdated DESC LIMIT 1