30. The following are the two data extensions setup in SFMC - CustomerDE and OrderDE
CustomerDE
Id FirstName LastName 101 Ross Geller 102 Rachel Green 103 Chandler Bing
OrderDE
Id Item Amount Customer_Id O-001 Monitor 14000 101 O-002 Mouse 400 101 O-003 Laptop 30000 102 O-004 Keyboard 800 103 O-005 Mouse 400 103
A user wants to display the customers with total orders, total amount, and have purchased more than one item. Which of the following is the correct query?
SELECT Id, FirstName, LastName, COUNT(o.Id), SUM(o.Amount) FROM CustomerDE c JOIN OrderDE o ON c.Id = o.Customer_Id GROUP BY Id, FirstName, LastName HAVING COUNT(o.Id) > 1
SELECT Id, FirstName, LastName, COUNT(o.Id), SUM(o.Amount) FROM CustomerDE c JOIN OrderDE o ON c.Id = o.Customer_Id
SELECT Id, FirstName, LastName, o.Id, SUM(o.Amount) FROM CustomerDE c JOIN OrderDE o ON c.Id = o.Customer_Id HAVING COUNT(o.Id) > 1 GROUP BY Id, FirstName, LastName, o.Id
SELECT Id, FirstName, LastName, o.Id, SUM(o.Amount) FROM CustomerDE c JOIN OrderDE o ON c.Id = o.Customer_Id GROUP BY Id, FirstName, LastName, o.Id