Reputation: 55
I want to show the least and most expensive movie from a table. But the sql below does not run in Microsoft Access. How do I fix it so it returns both the min and max values in 1 result table?
SELECT Cost,Movie_Title
FROM INVENTORY
WHERE Cost IN
(
SELECT max(Cost) as Maximum_Cost, min(Cost) as Minimum_Cost
FROM INVENTORY
);
Upvotes: 2
Views: 1206
Reputation: 97111
SELECT Movie_Title, Cost
FROM INVENTORY
WHERE
Cost=DMin("Cost","INVENTORY")
OR Cost=DMax("Cost","INVENTORY");
Upvotes: 2
Reputation: 12413
if you want the answer as two rows use Union to attach the results of a minimum and maximum queries together.
Upvotes: 1