table **salesrule_coupon**: fileds as the following: coupon_id code 1 Registered_send_5 2 test
table: salesrule_coupon_usage written as follows:
coupon_id customer_id times_used 1 1 1 1 ... 14 ... 1..
Now, I want to select times_used , where code =Registered_send_5 , where customer_id = $ id. how to write sql command? thanks u.
The following is mine, but it does not work.
$sql = "SELECT times_used FORM salesrule_coupon_usage as a left join salesrule_coupon as b on a.coupon_id = b.coupon_id where b.code = 'Registered_send_5' and customer_id=".'$id.";
when i put
SELECT times_used FORM salesrule_coupon_usage as a left join salesrule_coupon as b on a.coupon_id = b.coupon_id where b.code = 'Registered_send_5' and customer_id=1
in phpmyadmin. He shows
You have an error in the SQL syntax; check the manual that matches your MySQL server version for the correct syntax to use next to 'salesrule_coupon_usage as left join salesrule_coupon as b on a.co' on line 1
source share