[eluser]Andy UK[/eluser]
Hi all,
I have two types of parking spaces in my database. Individual spaces and double spaces where you have to move one car to get the other out. The sum of the individual parking spaces plus the double spaces gives me the total parking spaces available per property.
When querying the database, it's easy enough to return the total with something like this:
$this->db->select("property.parking_double + property.parking_individual as parking");
Trouble is, I'm not able to do the same with the where clause when querying for properties with a certain number of total parking spaces. This for example is not working:
$this->db->where('parking_individual + parking_double =', $this->session->userdata('parking'));
Is this possible or will i have to sum the two fields in the controller for every function that needs this result?
Thanks!