2 回答
TA贡献1802条经验 获得超10个赞
如果您使用的是 MySQL,您可以尝试以下查询:
SELECT count(*) tot_apt_in_month
FROM property
WHERE status='Sold'
AND MONTH(createdate) = month(curdate())
要查看结果,您至少应该查看echo行内容:
while($row = $result->fetch_array())
{
echo $row['tot_apt_in_month'];
echo "<br />";
}
或者
"SELECT MONTH(createdate) my_month, count(*) tot_apt_in_month
FROM property
WHERE status='Sold'
AND MONTH(createdate) = month(durdate())
GROUP BY MONTH(createdate)
";
while($row = $result->fetch_array())
{
echo $row['my_month'] . " " . $row['tot_apt_in_month'];
echo "<br />";
}
TA贡献1911条经验 获得超7个赞
您可以使用以下查询,该查询将返回包含月份和已售物业数量的多条记录。
SELECT count(id) soldPropertyCount, MONTHNAME(createdate)
FROM property WHERE status='Sold' GROUP BY MONTH(createdate)
希望对你有帮助!!
- 2 回答
- 0 关注
- 193 浏览
添加回答
举报