How to get the sum of the joined table with the Editor's php library

How to get the sum of the joined table with the Editor's php library

pcsintjanbaptistpcsintjanbaptist Posts: 20Questions: 9Answers: 1

If I wrote what I wanted to do in a query, I would write it like this:

SELECT
  s.ID,
  SUM((sd.amount * sd.price)) AS orderTotal
FROM
  sales_order s
  LEFT JOIN sales_order_details sd
    ON s.ID = sd.orderID
GROUP BY s.ID

How do I do this with the Datatables Editor PHP libraries?

Kind regards,

Gloria

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,722Questions: 1Answers: 10,108 Site admin
    Answer ✓

    Hi,

    Where do you want to show the resulting calculation? The Editor libraries don't support GROUP BY in the data loaded and edited by Editor I'm afraid, but you could use the $db->sql() method if you just want to execute that and get the data.

    Allan

This discussion has been closed.