[eluser]xwero[/eluser]
daBayrus got it right, just create methods for the different queries you need.
A model is an object that contains methods that fetch/manipulate similar data. The examples you gave are only changes in the where part of the sql statement.
There are people who follow the rule one model, one table too strict and then they create code to use model methods in another model which only adds fat to the code.
For instance if employees can buy things from the company and you need to display an overview of which employee bought what. You could be tempted to use the employee_model method that gets the employee name in the sales_model. There are two alternate solutions for this:
- add the employee name query to a sales_model method.
- extract the employee ids from the sales_model method results, get all the names, link the names to the sales_model method results
The last one is the best solution if you want your models to be as flexible as possible, if you have no intention of reusing the model the first alternative method will be the fastest because then you only need one sql statement.