1

i have 2 collections

1

Orders  
0   
date    "2019-07-05"
count   "2"
1   
date    "2019-06-20"
count   "2"
2   
date    "2019-06-18"
count   "2"
3   
date    "2019-06-17"
count   "2"
4   
date    "2019-06-14"
count   "1"  

2

Amount  
0   
date    "2019-07-05"
sum "6370.00000000"
1   
date    "2019-06-20"
sum "6491.00000000"
2   
date    "2019-06-18"
sum "4838.00000000"
3   
date    "2019-06-17"
sum "4838.00000000"
4   
date    "2019-06-14"
sum "1653.00000000"

In both collections looking date is Same . i want to sum index of second collection add in first collection and it make only one collection

how can do this . i tried $collection->addItem($collection2) it not work

1
  • you can use join query here to achive your requirement. Jul 5, 2019 at 14:26

1 Answer 1

-1

Collection it's just a flexible select query to some table in your DB. If you want to fetch some data or filter it - you may use methods like addFieldTofilter() You may also use custom sql SELECT with conditions like ( ... WHERE table1.data = table2.data) but it will be very controversial decision.

Your Answer

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

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