I am building a query using a multi-multi relationship table (connecting orders with line items). I am able to filter from related tables without a problem (example:
line_item.name=XYZ), but I only get simple views (Count of rows, Distinct values). I wanted to do a sum over a column in related table (ie: line_item.quantity) and was unable to do so.
I had to write custom SQL which does:
SELECT sum("woocommerce_line_item__via__wo"."quantity") AS "sum",...
to achieve this. Is it possible the same thing without custom SQL?