MS SQL Difficultys

Hello im currently doing Diplomia in web development and im having abit of trouble i have been asked to

Create a stored procedure called Task26 that will show the product name, price and quantity
in stock for the product that has the highest price. You must use a subquery to find the
desired result.

and i keep getting a error with my code when i use this

ALTER PROCEDURE Task26
AS
SELECT MAX (price),Quantityinstock,ProductName
FROM Products

Could anyone please tell me what im doing wrong?
Thank you.

The Awnser is.

ALTER PROCEDURE Task26
AS
SELECT Price,ProductName,Quantityinstock
FROM Products
WHERE Price IN (SELECT MAX (Price) FROM Products)

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.