I am working on a module, where I have 2 custom tables. One is of all customer who have added product to First table(one customer can add multiple tables) and that first table is displayed on grid.

On grid action I have a action column which has to show all products added added by a customer.

My frist tables structure( table name->rfq)

frist table

my second tables structure (table name->rfqitem) second table

this code gives output like below

    protected function _initSelect()

        ['secondTable' => $this->getTable('rfq')],
        'main_table.rfq_id = secondTable.customer_id', 

current output getting

but i expect result like this expect So how can achieve this.


  • Share your code what you have tried. So i can check. Nov 21, 2018 at 7:58
  • please check my updated Questin Nov 21, 2018 at 9:27
  • Please check my answer. Nov 21, 2018 at 9:46

1 Answer 1


You need to add where clause in joinLeft() query :

        ['secondTable' => $this->getTable('rfq')],
        'main_table.rfq_id = secondTable.customer_id', 
    )->where("main_table.id IS NOT null");
  • Item (Magento\Framework\View\Element\UiComponent\DataProvider\Document) with the same ID "2" already exists. This error is raised Nov 21, 2018 at 10:03
  • Use ->group("main_table.id"); after where() Nov 21, 2018 at 10:35
  • Please upvote again :) Nov 21, 2018 at 11:05
  • how it can be done using UI component? Sep 29, 2021 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.