database
database copied to clipboard
Different count result for related table condition
- bug report? yes
- feature request? no
- version: 2.4.4
Description
Hi guys,
I have different result from method count(). It looks like missing group by in built sql query when where contains condition on related table.
Steps To Reproduce
/**
* where condition for document
* count = 2
*/
$this->db->table('document')
->where('document.name IS NOT NULL')
->group('document.id')
->count('*');
/**
* where condition for document_item
* count = 3
*/
$this->db->table('document')
->where('document.name IS NOT NULL')
->where(':document_item.is_visible', 1)
->group('document.id')
->count('*');
Could you paste dummy data in sql format and tables?