-2
我有优惠券,并希望在创建日期后获得使用促销代码的所有行。从指定日期中选择所有销售
每个销售都有时间戳,创建的优惠券有时间戳。我想选择优惠券后的所有销售。
继承人我有。
$coupon = $this->db->query("SELECT * FROM group_coupon WHERE code='test' AND active='1'");
if (count($coupon) > 0) {
$amount = $this->db->query("SELECT * FROM group_coupon WHERE code='test'")->row()->amount;
$quantity = $coupon->row()->quantity;
echo "Quantity: " . $quantity;
echo "Time: " . $coupon->row()->timestamp;
// I know the query is wrong
$time_st = $coupon->row()->timestamp;
$all = $this->db->query("SELECT * FROM sale WHERE coupon='test' AND $time_st > timestamp")->row()->coupon;
// then id like to do a count($all)
}
与此代码会发生什么?你正在使用SQL服务器或MySQL? – chris85
mysql --------- – Gilbert
好的,这段代码会发生什么?错误,不正确的结果,其他? – chris85