I have 3 tables:
"Cars" table, where every car has an ID.
"Operations" table that holds the operations have been done on a car.
| ID | CarID | Operation | User | JournalID |
| --- | ----- | --------- | ---- | --------- |
"Journal" table that records the costs of the operations and other daily expenses:
| ID | Amount | Date |
| --- | ------ | ---- |
What I want is knowing the sum of operations costs amount
of a specific car, I was looping through all operations of that car and then looping for every journal row to sum, which lead to a bad result of course.
What can I do in that case to get the result as fast as possible?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2DaDc8c
via IFTTT
Aucun commentaire:
Enregistrer un commentaire