Reputation: 247
I want to get Min and Max value of Column using one query. Is that Possible?
Here is my code:
$this->db->select_max('fare');
$this->db->select_min('fare');
$this->db->from('travels_detail');
$query = $this->db->get();
Upvotes: 0
Views: 6278
Reputation: 639
You can try this:
$this->db->select('MAX(fare) as max_fare, MIN(fare) as min_fare');
$this->db->from('travels_detail');
$query = $this->db->get();
Upvotes: 4