Timeline for How to write inner join query in collection method (magento2)?
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 14, 2018 at 8:42 | comment | added | Hamza Mustafa | not working..... | |
Apr 14, 2018 at 8:42 | comment | added | Hamza Mustafa | $collection->getSelect()->join( 'sales_order_status_history', // note this join clause! 'main_table.entity_id = sales_order_status_history.parent_id', array('sales_order_status_history.created_at') ) ->where("sales_order_status_history.status = 'processing_closed'"); $collection->getSelect()->group('main_table.created_at'); | |
Apr 14, 2018 at 8:34 | comment | added | Hamza Mustafa | how brother? please paster your query below i will mark as green | |
Apr 14, 2018 at 8:06 | comment | added | Sohel Rana | You need to modify group by too. Add main_table.created_at in group by clause. | |
Apr 14, 2018 at 7:59 | comment | added | Hamza Mustafa | created_at column is present in both tables so its returning this ambiguous error using your query too bro | |
Apr 14, 2018 at 7:58 | comment | added | Hamza Mustafa |
Integrity constraint violation: 1052 Column 'created_at' in group statement is ambiguous, query was: SELECT main_table .*, sales_order_status_history .created_at FROM sales_order AS main_table INNER JOIN sales_order_status_history ON main_table.entity_id = sales_order_status_history.parent_id WHERE (sales_order_status_history.status = 'processing_closed') AND (main_table.created_at >= '2018-04-06 19:00:00') AND (main_table.created_at <= '2018-04-14 18:59:59') GROUP BY DAYNAME(created_at)
|
|
Apr 14, 2018 at 7:49 | review | Suggested edits | |||
Apr 14, 2018 at 8:45 | |||||
Apr 14, 2018 at 7:41 | history | answered | Sohel Rana | CC BY-SA 3.0 |