-
GROUP BY CLAUSE w/ aggregate in sqlcourse2
Hello I'm a very fresh newbie in the world of sql. I have gone through sqlcourse 1 and now I think I am stuck with a question in the GROUP BY section of sql course2. Here's the question:
(I am using the website's built in table "items_ordered")
I am trying to display the item (which is a tent), minimum price and order date when that tent was ordered with that min price.
Somehow, it seems that when I query -
select item, max(price), order_date from items_ordered where item = 'tent' group by item;
or
select item, min(price), order_date from items_ordered where item = 'tent' group by item;
the results show the same order_date for both queries. It seems to only show the date when the tent was ordered with the max price. The order_date doesn't seem to be corresponding with the min(price). Is this how the sql database works or am I missing something in my statement to link these two together?
Appreciate anyone who can help as I try to self-learn more about sql.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|