database icon indicating copy to clipboard operation
database copied to clipboard

Different count result for related table condition

Open podolinek opened this issue 8 years ago • 1 comments

  • 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('*');

podolinek avatar Oct 11 '17 12:10 podolinek

Could you paste dummy data in sql format and tables?

h4kuna avatar Feb 28 '18 07:02 h4kuna