Reputation: 97
I used the following statement to filter records by subject ids. (Here subject_id=5)
$this->datatables->where('letter_letter.subject_id', 5);
That is working perfectly. Further I want to filter records in subject_id range like 1 to 10. Then I changed my code as follows :
$this->datatables->where('letter_letter.subject', 10, '<');
But did not get the desired output. How can I edit my code to get expected result ? Can anyone help me ?
Upvotes: 1
Views: 35
Reputation: 1117
This is one way you can make a where
query with two conditions:
$this->datatables->where("letter_letter.subject_id IS ? AND letter_letter.subject BETWEEN ? AND ?", 5, 1, 10)
Upvotes: 0
Reputation: 522506
Just use two calls to where()
to define the range:
$this->datatables->where('letter_letter.subject_id >= ', 1);
$this->datatables->where('letter_letter.subject_id <=', 10);
Upvotes: 1