0

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

<?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);
?>
4

2 回答 2

2

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

SELECT * FROM  'table' order by lastupdated desc limit 1
于 2013-10-23T07:12:16.010 回答
0

尝试这个..

SELECT * FROM  'table' ORDER BY lastupdated DESC LIMIT 1
于 2013-10-23T07:13:47.243 回答