SELECT SalesOrders_Customers."firstname", SalesOrders_Customers."lastname", COUNT(*) AS "Number of Orders", SUM(SalesOrders."subtotal") 'Total Order Amount' FROM "SalesOrders" INNER JOIN "Customers" AS SalesOrders_Customers ON "SalesOrders"."customer_id" = SalesOrders_Customers."customer_id" WHERE strftime('%Y', "SalesOrders"."created_at") = '2015' /*try changing year if you need*/ GROUP BY SalesOrders_Customers."firstname", SalesOrders_Customers."lastname" ORDER BY 4 DESC
Skyvia Query allows you to run SQL queries against databases and cloud applications from web browser. Access and manage your data from anywhere, build reports, arrange your data in the most informative way and simplify your decision-making process easily!