我想只显示自过去14天以来没有订购的客户的记录。 所以我需要从当前日期分配最后一个订单日期,并仅显示自14天或更长时间以来没有订购的订单。 请注意在数据库上排序的日期格式,如下所示:01-25-2017和数据类型varchr(无法更改) 这是我的代码
<?php
$q_customer = $conn->query("SELECT * FROM customer_order INNER JOIN customer on customer_order.phone= customer.phone GROUP BY customer_order.phone" ) or die(mysqli_error());
while($f_customer = $q_customer->fetch_array()){
?>
<tr>
<td><?php echo $f_customer['phone']?></td>
<td><?php echo $f_customer['first_name']?></td>
<td><?php echo $f_customer['last_name']?></td>
<td><?php echo $f_customer['order_date']?></td>
</tr>
<?php
}
?>
答案 0 :(得分:0)
在您的代码中添加group by customer_id
,然后添加where条件以按日期过滤订单。