Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user

iI wrote the join query with customer table. the query is, when iI execute this query they will return 5 records:

$collection = $this->getCollection()
    ->addAttributeToSelect('userid')
    ->addAttributeToSelect('firstname')
    ->addAttributeToSelect('lastname')
    ->addAttributeToSelect('profile_image')
    ->addAttributeToSelect('specialist')
    ->addAttributeToFilter('group_id', 5);
$collection->getSelect()
    ->joinLeft(
        $collection->getSelect()->joinLeft(array('rating'=>'flrating''rating' => 'flrating'), 
        'e.entity_id = rating.reviewed_user_id', 
        array('total_rating'=>'count'total_rating' => 'count(rating.review_id)'));
            );
$collection->getSelect()
    ->group('e.entity_id');

butBut when iI execute the simple query they will return correct result  (6 records):

  $collection = $this->getCollection()
    ->addAttributeToSelect('userid')
    ->addAttributeToSelect('firstname')
    ->addAttributeToSelect('lastname')
    ->addAttributeToSelect('profile_image')
    ->addAttributeToSelect('specialist')
    ->addAttributeToFilter('group_id', 5);
        return $collection;

even iEven I put the following code in collection table also the code is:

 public function getSelectCountSql()
    {
        $countSelect = parent::getSelectCountSql();
        $countSelect->reset(Zend_Db_Select::GROUP);
        return $countSelect;
    }

canCan you please explain what is my problem and how to overcome the pagination issue, for your further information see the below screen.:

   **result with join query:**

enter image description hereResult with join query: Result with join query

resultResult with simple query:

enter image description hereResult with simple query

i wrote the join query with customer table. the query is, when i execute this query they will return 5 records

$collection = $this->getCollection()->addAttributeToSelect('userid')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToSelect('profile_image')->addAttributeToSelect('specialist')->addAttributeToFilter('group_id',5);
            $collection->getSelect()->joinLeft(array('rating'=>'flrating'),'e.entity_id = rating.reviewed_user_id',array('total_rating'=>'count(rating.review_id)'));
            $collection->getSelect()->group('e.entity_id');

but when i execute the simple query they will return correct result(6 records)

  $collection = $this->getCollection()->addAttributeToSelect('userid')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToSelect('profile_image')->addAttributeToSelect('specialist')->addAttributeToFilter('group_id',5);
        return $collection;

even i put the following code in collection table also the code is

 public function getSelectCountSql()
    {
        $countSelect = parent::getSelectCountSql();
        $countSelect->reset(Zend_Db_Select::GROUP);
        return $countSelect;
    }

can you please explain what is my problem and how to overcome the pagination issue, for your further information see the below screen.

   **result with join query:**

enter image description here

result with simple query

enter image description here

I wrote the join query with customer table. the query is, when I execute this query they will return 5 records:

$collection = $this->getCollection()
    ->addAttributeToSelect('userid')
    ->addAttributeToSelect('firstname')
    ->addAttributeToSelect('lastname')
    ->addAttributeToSelect('profile_image')
    ->addAttributeToSelect('specialist')
    ->addAttributeToFilter('group_id', 5);
$collection->getSelect()
    ->joinLeft(
        array('rating' => 'flrating'), 
        'e.entity_id = rating.reviewed_user_id', 
        array('total_rating' => 'count(rating.review_id)')
    );
$collection->getSelect()
    ->group('e.entity_id');

But when I execute the simple query they will return correct result  (6 records):

$collection = $this->getCollection()
    ->addAttributeToSelect('userid')
    ->addAttributeToSelect('firstname')
    ->addAttributeToSelect('lastname')
    ->addAttributeToSelect('profile_image')
    ->addAttributeToSelect('specialist')
    ->addAttributeToFilter('group_id', 5);
return $collection;

Even I put the following code in collection table also the code is:

public function getSelectCountSql()
{
    $countSelect = parent::getSelectCountSql();
    $countSelect->reset(Zend_Db_Select::GROUP);
    return $countSelect;
}

Can you please explain what is my problem and how to overcome the pagination issue, for your further information see the below screen:

Result with join query: Result with join query

Result with simple query:

Result with simple query

Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
deleted 6 characters in body
Source Link
Keyur Shah
  • 18.1k
  • 6
  • 67
  • 80

i wrote the join query with customer table. the query is, when i execute this query they will return 5 records

i wrote the join query with customer table. the query is, when i execute this query they will return 5 records 
    
    $collection = $this->getCollection()->addAttributeToSelect('userid')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToSelect('profile_image')->addAttributeToSelect('specialist')->addAttributeToFilter('group_id',5);
            $collection->getSelect()->joinLeft(array('rating'=>'flrating'),'e.entity_id = rating.reviewed_user_id',array('total_rating'=>'count(rating.review_id)'));
            $collection->getSelect()->group('e.entity_id');

 
but when i execute the simple query they will return correct result(6 records)

but when i execute the simple query they will return correct result(6 records)

  $collection = $this->getCollection()->addAttributeToSelect('userid')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToSelect('profile_image')->addAttributeToSelect('specialist')->addAttributeToFilter('group_id',5);
        return $collection;

even i put the following code in collection table also the code is

even i put the following code in collection table also the code is

 public function getSelectCountSql()
    {
        $countSelect = parent::getSelectCountSql();
        $countSelect->reset(Zend_Db_Select::GROUP);
        return $countSelect;
    }
can you please explain what is my problem and how to overcome the pagination issue, for your further information see the below screen.

can you please explain what is my problem and how to overcome the pagination issue, for your further information see the below screen.

   **result with join query:**

enter image description here

result with simple query

enter image description here

i wrote the join query with customer table. the query is, when i execute this query they will return 5 records 
    
    $collection = $this->getCollection()->addAttributeToSelect('userid')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToSelect('profile_image')->addAttributeToSelect('specialist')->addAttributeToFilter('group_id',5);
            $collection->getSelect()->joinLeft(array('rating'=>'flrating'),'e.entity_id = rating.reviewed_user_id',array('total_rating'=>'count(rating.review_id)'));
            $collection->getSelect()->group('e.entity_id');

 
but when i execute the simple query they will return correct result(6 records)

  $collection = $this->getCollection()->addAttributeToSelect('userid')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToSelect('profile_image')->addAttributeToSelect('specialist')->addAttributeToFilter('group_id',5);
        return $collection;

even i put the following code in collection table also the code is

 public function getSelectCountSql()
    {
        $countSelect = parent::getSelectCountSql();
        $countSelect->reset(Zend_Db_Select::GROUP);
        return $countSelect;
    }
can you please explain what is my problem and how to overcome the pagination issue, for your further information see the below screen.

   **result with join query:**

enter image description here

result with simple query

enter image description here

i wrote the join query with customer table. the query is, when i execute this query they will return 5 records

$collection = $this->getCollection()->addAttributeToSelect('userid')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToSelect('profile_image')->addAttributeToSelect('specialist')->addAttributeToFilter('group_id',5);
            $collection->getSelect()->joinLeft(array('rating'=>'flrating'),'e.entity_id = rating.reviewed_user_id',array('total_rating'=>'count(rating.review_id)'));
            $collection->getSelect()->group('e.entity_id');

but when i execute the simple query they will return correct result(6 records)

  $collection = $this->getCollection()->addAttributeToSelect('userid')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToSelect('profile_image')->addAttributeToSelect('specialist')->addAttributeToFilter('group_id',5);
        return $collection;

even i put the following code in collection table also the code is

 public function getSelectCountSql()
    {
        $countSelect = parent::getSelectCountSql();
        $countSelect->reset(Zend_Db_Select::GROUP);
        return $countSelect;
    }

can you please explain what is my problem and how to overcome the pagination issue, for your further information see the below screen.

   **result with join query:**

enter image description here

result with simple query

enter image description here

Source Link
senthil
  • 1.7k
  • 2
  • 27
  • 56

magento customer table join query group by make problem in pagination

i wrote the join query with customer table. the query is, when i execute this query they will return 5 records 
    
    $collection = $this->getCollection()->addAttributeToSelect('userid')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToSelect('profile_image')->addAttributeToSelect('specialist')->addAttributeToFilter('group_id',5);
            $collection->getSelect()->joinLeft(array('rating'=>'flrating'),'e.entity_id = rating.reviewed_user_id',array('total_rating'=>'count(rating.review_id)'));
            $collection->getSelect()->group('e.entity_id');


but when i execute the simple query they will return correct result(6 records)

  $collection = $this->getCollection()->addAttributeToSelect('userid')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToSelect('profile_image')->addAttributeToSelect('specialist')->addAttributeToFilter('group_id',5);
        return $collection;

even i put the following code in collection table also the code is

 public function getSelectCountSql()
    {
        $countSelect = parent::getSelectCountSql();
        $countSelect->reset(Zend_Db_Select::GROUP);
        return $countSelect;
    }
can you please explain what is my problem and how to overcome the pagination issue, for your further information see the below screen.

   **result with join query:**

enter image description here

result with simple query

enter image description here