Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [join]

The tag has no usage guidance.

3
votes
0answers
36 views

How to join multiple repositories

Suppose if I want to join product repository and orderItem repository, then how can do that? There is way to join multiple collections (methods like join, joinRight, joinLeft, ...), how to do same ...
0
votes
1answer
58 views

How to get collection from two tables and show in Admin grid using Union query Magento2.2.5?

I want to show two table values in Admin grid using UI Component (which has no relation) so using union query it can be achieved. How to get the collection from two tables? Table structure 1 Table ...
0
votes
1answer
46 views

Magento2 use Multiple LIKE operator in Join Query

I have used Join query,in which i'm able to fetch only one row by below query where $productId = 10 $collection->getSelect()->where('paproduct.product_id = (?)', $productId); I want to use ...
1
vote
0answers
91 views

get join table's all rows with collection magento2

I am fetching a collection (of user table), that is retrieving correctly. Now I have one more table (ex.- address) that has multiple row related collection table primary key. I want to fetch them all ...
0
votes
1answer
711 views

Magento 2 Join table customer entity and customer address entity

I am trying to join customer entity table and customer address entity table. I am getting error in below code. What could be the issue $agency_name=$customerData->getDefaultShippingAddress(...
0
votes
2answers
248 views

Magento 1.9 : How to combine two collection data?

I have two different collection one is of order payment transaction and other one is of sales order as show below: $transactionData=Mage::getModel('sales/order_payment_transaction')->getCollection(...
0
votes
0answers
76 views

Magento more than 61 product attribute database tables in join query

I'm using product feed extension and when I try to generate feed It throws me below error SQLSTATE [HY000]: General error: 1116 Too many tables; MySQL can only use 61 tables in a join, query was: ...
0
votes
0answers
101 views

How to add use index for join in magento left join

I have two queries - 1. Query $select = $this->_getReadAdapter()->select()->from(array('main_table' => $this->getMainStoreTable($category->getStoreId())), array('...
0
votes
1answer
58 views

Magento 2: What's best way to convert MySql to Magento

I've below MySql query, I would like to change use it in Magento format. How can i do that ? SELECT customer_entity_varchar.value, customer_entity_text.value from customer_entity INNER JOIN ...
0
votes
1answer
293 views

Left join order grid collection using observer method. Magento 1.9

I'm trying to add a grid to order listing table following this awesome blog which works if all code copied but I'm unable to customize it. And I want to show the data from my custom table. I've ...
0
votes
1answer
416 views

Left join on custom collection, to get product name by product ID

There's a collection which contains product ids. I'd like to join it with the magento table that stores paroduct names, in order to add product name to collection. $collection = Mage::getModel("...
0
votes
1answer
173 views

After join, use the result join again in Magento2

For example, I create a table which has product sku, I use the table LEFT JOIN `catalog_product_entity` table to get the entity_id, then want to use the entity_id result to LEFT JOIN `...
4
votes
1answer
1k views

Magento 2:SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'entity_id' in where clause is ambiguous

I have added a new column in customer grid using the following: app/code/Company/Module/etc/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
2
votes
1answer
667 views

Join eav attributes

Im trying to join attributes in my collection on my grid view of "supply needs" from my ERP (Erp boost my shop) The collection is loaded like this: $collection = Mage::getModel('Purchase/SupplyNeeds'...
1
vote
0answers
321 views

SQL UPDATE with JOIN

Knowing I want Magento assemble and execute the following query : UPDATE `catalog_product_entity_media_gallery_value` AS `tGV` INNER JOIN `catalog_product_entity_media_gallery` AS `tG` ON `tG`...
1
vote
0answers
451 views

How to sort products by bestsellers (e.g. by sales) in Magento 2

these days I've faced a problem: I needed to to sort products by sales. So, first of all I decided to add this field to collection of products and the order it using method $collection->setOrder(). ...
1
vote
1answer
1k views

Need help with collection joinField() - Magento 2

Can anyone describe how to use joinField() method of collection (Magento\Eav\Model\Entity\Collection\AbstractCollection). I actually don't know what means each argument: public function joinField($...
1
vote
0answers
246 views

Magento 2 Join two table and dispaly value in grid

public function addCustomerData($filter = null) { $customersSelect = $this->customerResource->getConnection()->select(); $customersSelect->from( ['customer' ...
0
votes
0answers
177 views

Magento 2; joinLeft() not working

I have this code to join status to the order item collection: $orderItems = $this->orderItemCollection->addFieldToSelect( array('item_id','order_id', 'created_at', 'updated_at','...
0
votes
1answer
334 views

Remove the single quotes from join

I have this magento code : $subquery = new \Zend_Db_Expr('SELECT DISTINCT value from catalog_product_entity_int where row_id in (select row_id from catalog_product_entity_int where attribute_id = 97 ...
1
vote
1answer
2k views

Nested/subquery select in a join query

I have this working SQL query : select prd_brand.* from prd_brand inner join ( select distinct value from catalog_product_entity_int where rowid in (select rowid from ...
3
votes
1answer
385 views

How to convert raw PHP Join Query into Magento Join Query

How to convert raw php LEFT JOIN query in to magento query? What is Magentos syntax for? Here is my query: SELECT fieldsmanager_orders.value,sales_flat_order_address.entity_id FROM ...
1
vote
1answer
19 views

I’m looking for a way to find all orders that the “bill to” and “ship to” are different states and the dollar amounts associated with those orders

I know that I could check in the sales flat tables. I would probably have to look into sales_flat_order and sales_flat_order_address and do a SQL join. Additionally, the entity_id would be the ...
0
votes
1answer
611 views

How i can join eav_attribute_option_value table into my collection and get from him “frontend_label” of colors?

I have a products collections. But in "color" i see option_id number. Mage::getModel('catalog/product') ->getCollection() ->addStoreFilter(Mage::app()->...
0
votes
1answer
247 views

Sorting Collection after joinField not working

I have a collection of products which I filter and show out of stock items only and it works fine. This is what I have: $collection = Mage::getResourceModel('reports/product_collection') ->...
1
vote
1answer
189 views

Fatal error on `prepareColumns` method

Getting fatal error on Item (Mage_Catalog_Model_Product) with the same id "223" already exist Here 223 is my product Id My _prepareCollection() Method protected function _prepareCollection() { ...
1
vote
1answer
95 views

How to use collections or joins in Magento 2

I'm trying to filter by order_item to get a list of orders. Get all orders where an order item has a price greater than 5. How would this be done? Collections? Joins?
5
votes
2answers
994 views

Join 3 tables in Magento 2

I am new to magento 2, And want to join 4 tables. TABLE 1) market_p_userdata (columns -> seller_id, image) TABLE 2) market_product (columns -> seller_id, magepro_id) TABLE 3) ...
1
vote
0answers
421 views

How to get parent product collection from child product collection

I have a simple product collection and I want to get a collection of parent products from the child product collection. $child_collection = Mage::getResourceModel('catalog/product_collection') -&...
2
votes
1answer
899 views

How to use a subquery while performing left join in magento

I want my query to filter only distinct product_id from the table catalog_category_product . The raw sql query goes like this : SELECT * FROM catalog_category_entity AS catalog_category_table LEFT ...
0
votes
2answers
437 views

JoinField Show error same id is already exists

We want to change below line: ->joinField('store_credit','kartparadigm_storecredit_creditinfo','total_credits', 'c_id=entity_id', null, 'left'); with this one: ->joinField('store_credit','...
2
votes
1answer
597 views

Foreach loop taking long time in magento product collection with limit

I have following code in which I have join product collection with sales order item table. this query takes fraction of a seconds to execute but foreach loop after that takes around half minute while ...
3
votes
1answer
2k views

Custom admin grid filter - error when searching joined column

I have a custom grid with columns created by joining a flat table to the customer collection. Everything works fine except when i try to filter the list using any of the column added from the flat ...
0
votes
1answer
360 views

How to convert mysql query in magento collection

this is my mysql query . I want to convert in magento collection. reference link https://stackoverflow.com/questions/34253461/repeat-a-result-row-multiple-times-by-value-in-row select Item , ...
0
votes
1answer
2k views

I am getting an error General error: 1111 Invalid use of group function. What am I doing wrong?

I have this code $orderModel = Mage::getModel('sales/order'); $ordercollection = $orderModel->getCollection() ->setPageSize(20) ->setCurPage(1) ->join(array('...
3
votes
2answers
4k views

How to join a table with a Magento 2 repository

I am trying to extend inventory stock items by joining my own table with added information. When the product page is loaded it gets the stock item via StockItemRepository::getList($criteria). So I ...
1
vote
1answer
947 views

Determine if collection has an attribute in the select

I want to join a custom field to a product collection, and the field I'm using to join it on is a custom attribute. My observer method is currently doing this: # Event: global/...
0
votes
1answer
356 views

How to LEFT-JOIN 'catalog/category' fields to 'sales/order_item' collection?

I'm trying to left-join some of the 'catalog/category' attributes to a 'sales/order_item' collection. For example: a satisfying result will let me add the category-name to the order-item data. *I ...
6
votes
1answer
767 views

Order by joined custom table

I've got a productcollection, which i joined a custom table to. I'd now like to order the collection on the custom joined table row "custom_row_value". I've tried the below method, but this does not ...
1
vote
1answer
99 views

How to join three tables for filteration?

I am applying filter on order collection. I am stuck in a situation, I have added a custom attribute to "customer address". that is in table "customer_address_entity_varchar", now I have to join ...
5
votes
1answer
6k views

Understanding setSelect()->join Need to join two custom collections

I am confused understanding the correct usage of $collection->getSelect()->join(... to bring two custom model resources together. I tried following other examples using the getSelect method. I ...
0
votes
1answer
438 views

Unrecognized method 'isLoaded()' in Magento 2

I'm trying to join product and my custom table but it's returning error Unrecognized method 'isLoaded()' my code is: /** * @param \Magento\Backend\Block\Template\Context $context * @param \...
1
vote
0answers
414 views

How to add invoice column to payment grid

I have a custom grid that show all information of save CC method per order. protected function _prepareCollection() { $collection = Mage::getModel('sales/order_payment')->...
3
votes
1answer
2k views

Cannot sorting joined column in Magento Grid

I have joined 2 columns to customer grid, I can make them filterable but I don't know how to make them sortable. Here is my _prepareCollection function: protected function _prepareCollection() { ...
4
votes
3answers
2k views

How to join a calculated column from a table to collection

I have a table name stat_customer look like this: I want to add a column page_view to customer collection to show at grid page. page_view is total page view of product page for each customer. My SQL ...
1
vote
1answer
1k views

Join to get thumbnail from sales order item - add column to order grid [duplicate]

I'm trying to use an observer to add the thumbnail path to the sales order grid collection - the purpose of this is to add an extra column to the order grid which displays the sales item images. I've ...
0
votes
2answers
98 views

Complex custom collection join problem

I have created tables, models etc for an extention and can get collections from each model individually fine. Here are the tables in question: orders_table entity_id | magento_order_id | ...
1
vote
1answer
3k views

Admin Grid Filtering on Joined Column

I have an admin grid that I'm using, and pulling in custom model and displaying. Everything works fine, and all columns can filter/sort, except when I try to use a column that is not inherent to my ...
1
vote
1answer
375 views

Join two tables cms/page and cms/page_store

I will try get all pages assign to the website with name $collection = Mage::getModel('cms/page')->getCollection(); $collection->getSelect() ->join( array('cps' => $collection-&...
4
votes
1answer
3k views

How to join a collection with a query

I have a table represented in backend with two rendered fields, but when I try to make a CSV export from this grid, those two fields are not included. So I tried to make a join from the initial ...