0

I have a table as follows: enter image description here

Now I want to count rows where ship_date is past date. And I am trying as follows:

 $today = date('yy-m-d');
 $sql = "SELECT count(*) as total FROM spot_shipment_order where date('ship_date') < '$today'";

Today's date is: 2020-04-27 and final SQL is: SELECT count(*) as total FROM spot_shipment_order where date('ship_date') < '2020-04-27'. As 2020-04-29 is not past date with respect to today's date, hence the above SQL should count 0. it returns 1. Strange!. this problem make me cry. I think I am doing some mistakes and can't explore that mistake. Any help is appreciated. Thanks in advance.

jarlh
  • 42,561
  • 8
  • 45
  • 63
Abdus Sattar Bhuiyan
  • 3,016
  • 4
  • 38
  • 72

0 Answers0