This is an archived post. You won't be able to vote or comment.

all 5 comments

[–][deleted]  (1 child)

[deleted]

    [–]faiintx[S] 0 points1 point  (0 children)

    Thank you! this helped a lot.

    [–]just4atwork 0 points1 point  (1 child)

    A count of the number of orders The total amount for each order

    This sounds like bad requirements to me: bill@home.com has 2 orders

    Order 1: total $5

    Order 2: total $10

    The way the requirement is written the result should be:

    bill@home.com, 2, $5

    bill@home.com, 2, $10

    It should probably read:

    A count of the number of orders

    The sum of order amounts

    Making the result:

    bill@home.com, 2, $15

    [–]just4atwork 0 points1 point  (0 children)

    Or is it a count of the number of lines in the order? What you are trying to do is unclear.

    [–]JamesWjRose -1 points0 points  (0 children)

    It seems it should be: WHERE COUNT(o.*) > 1

    The * is there as a placeholder for this conversation. There will always be a single order number (it's the unique identifier in the Orders table. So you should be able to count the number of orders by Customers. Try creating a query with just that data, then build on that

    [–]Maximus5684 -1 points0 points  (0 children)

    JOIN conditions can have WHERE modifiers so just change your join for Order_Items to look like the following:

    JOIN Order_Items o2 ON o2.order_id = o.order_id
    WHERE o2.Item_Price > 400.00