From the course: Learning Data Analytics Part 2: Extending and Applying Core Knowledge
Solution: Total number orders by customer
From the course: Learning Data Analytics Part 2: Extending and Applying Core Knowledge
Solution: Total number orders by customer
(bouncy music) - I'm going to start by creating the query for my customers and my orders. I'll go to create, I'll choose query design. I'll bring in customer and orders. Okay, I'll go ahead and relate the customer to the CustomerID here. I'll bring in my CustomerName, and I'll bring in my OrderID. Okay, let's run this query. Okay, perfect. All right, now what I want to do is go to my design view. Now, part of the challenge is to show all the customers regardless of order, so I'll go adjust my join properties to include all records from customers. And let me go run that again. Trying to get a couple here or three. All right, let me get back up to my first record. Okay, so now that I have that base data set good to go, I'll go to my totals. I'll group by CustomerID, group by CustomerName. But I actually want to do a count of the OrderID. And then I can run the query. Perfect. Let me go to my last. Awesome, and I have zeros. Okay, so now I always want it to show the highest customer orders first, so I'll go ahead and put that sort into my grid. Let's just go run that. Went the wrong direction, let's do descending. Okay, perfect. I'll go ahead and save this challenge as ChallengeQuery. Click OK, and we're all done.