我需要在MySQL
中添加值,看看它是否大于另一个值,然后echo
行数。
$result = mysql_query("SELECT created_at,seconds FROM table WHERE created_at + seconds > CURTIME()");
$num_rows = mysql_num_rows($result);
echo $num_rows;
答案 0 :(得分:2)
如果seconds
是整数列,请使用DATE_ADD
:
SELECT created_at, seconds FROM table
WHERE DATE_ADD(created_at, INTERVAL seconds SECOND) > CURTIME()