php - fetch daily customer flow data -
i trying fetch daily customer flow table 'tbl_transaction' using following query:
select day(date_time) date, sum(members) customers tbl_transaction month(date_time)='.$mon.' group "date_time" but generating dataset not grouped according date:
date | customers 11 3 12 2 13 1 14 2 14 3 15 7 16 4 17 3 17 2 17 7 17 2 18 5 18 5 18 4 19 2 how show dates , no of customers on particular date.
your query should like
select day(date_time) date, sum(members) customers tbl_transaction month(date_time)='03' group date(date_time) since date_time in y-m-d h:i:s doing group date_time return rows.
also if group date obtained day(date_time) date yield wrong result.
day('2014-01-01') = 1 day('2014-02-01') = 1 so sum result days irrespective of actual date.
Comments
Post a Comment