$sql = "select *, sum(order_total) as n from `order` where order_datego between '" . $d3 ."-". $d2 ."-". $d1 . "' and '" . $d6 ."-". $d5 ."-". $d4 . "' and sta_id=3 and sta_id=4 group by order_datego";
ถ้าเป็นแบบนี้มันไม่ขึ้นอะไรซักอย่าง
$sql = "select *, sum(order_total) as n from `order` where order_datego between '" . $d3 ."-". $d2 ."-". $d1 . "' and '" . $d6 ."-". $d5 ."-". $d4 . "' and sta_id=3 or sta_id=4 group by order_datego";
มันขึ้นมาโดยไม่ต้องทำอะไร
$sql = "select *, sum(order_total) as n from `order` where order_datego between '" . $d3 ."-". $d2 ."-". $d1 . "' and '" . $d6 ."-". $d5 ."-". $d4 . "' and sta_id=3 group by order_datego";
$sql = "select *, sum(order_total) as n from `order` where order_datego between '" . $d3 ."-". $d2 ."-". $d1 . "' and '" . $d6 ."-". $d5 ."-". $d4 . "' and (sta_id=3 or sta_id=4) group by order_datego";
หรือ
$sql = "select *, sum(order_total) as n from `order` where order_datego between '" . $d3 ."-". $d2 ."-". $d1 . "' and '" . $d6 ."-". $d5 ."-". $d4 . "' and sta_id in (3, 4) group by order_datego";