how to simplify this statement? php mysql -
I need to retrieve many selections from the mysql table, I need to make the statement easier
This is my statement
$ starard = dateelect $ enddate = dateelect select SELECT count (different (customer)) my_table as a customer where 'date_field' between '$ startdate' and ' Enddate 'SELECT count (different (customer)) as computer 1 my_table where computer = 1 and date_field between' $ startdate 'and select' $ enddate 'count (different (customer)) as computeris2 where my_table compute I have around 10 fields, each with 4 or 5 values (option) in each field (such as a computer), between 'r = 2' and 'date_field' between '$ startdate' and '$ enddate' Want to count specific customers and all between 2 dates
The other problem is that this date is the timestamp of mysql, it does not return true and does not exclude today's record, unless it does not select the date of tomorrow, it works , I think that this is a one-time issue, how can I make it? Can I fix the problem of time from time to time with the date of calculation?
You date / time problem For the rest, you can use conditional aggregation to do everything in a query: Selection number as customer (different (customer)), count (different cases When computer = 1 subscriber ends) as computer 1, counting (different position when computer = 2 then customer end) my_table as computer 2 where '$ startdate' and '$ enddate' between date (date_field); This value stores values as separate columns instead of separate rows.
Comments
Post a Comment