- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2021
09:14 AM
04-09-2021
09:14 AM
Join two tables and got Item with the same ID already exists.error
Hello,
I have to do a form where customer can manage prices for products.
We have three tables
1. group_id; group_name
2. entity_id; group_id; some_id
3. item_id; group_id;sku; price
So, i want to fetch all items and show their some_id.
I'm using grid collection for table 3. I've added this join
protected function _initSelect() { parent::_initSelect(); $linkTable = $this->getTable('TABLE_2'); $this->getSelect() ->join( ['link' => $linkTable], 'main_table.group_id = link.group_id' ); $this->getSelect()->group(['main_table.group_id','link.some_id']); }
Rersult of this quesry is
And then i pass this collection into admin grid i got
(Magento\Framework\View\Element\UiComponent\DataProvider\Document) with the same ID "48" already exists.
Maybe someone know how to fix it. or maybe i have to use something different ?
Thanks.
Labels:
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2021
09:22 AM
04-09-2021
09:22 AM
Re: Join two tables and got Item with the same ID already exists.error