In my database I'm using the current time stamp based on the customer orders, stored in a table. I want to know, within two time periods, how many customers order a request. Suppose 10:12:16
to 13:32:54
, in this time period how many(count) customers requested? In the same way as in between 2 dates.
SELECT * FROM your_table WHERE time_stamp_column BETWEEN '10:12:16' AND '13:32:54';
The Simple My SQL Query is this :
SELECT COUNT(*) FROM your_table WHERE time_stamp_column BETWEEN '10:12:16' AND '13:32:54';
Using Codeigniter's Query Builder you can do this :
public function getCount(){
return $this->db->get_where('your_table','time_stamp_column BETWEEN "10:12:16" AND "13:32:54"')->num_rows();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.