SQL Server Management
What query can I write to display the entire row (and only thatrow) of a table that has the highest number in 1 column and aspecific string in another.
For example:
I want to display the row that has the highest price, but hasalso has a “Sold” status. This means the row with Owner3 would bethe only one displayed.
Solution
SELECT * FROM ORDERS WHERE STATUS=’Sold’ ANDPRICE=(SELECT MAX(PRICE) FROM ORDERS))
Here I am using the sub query to get the highest priceand comparing with all the prices where status is Sold
I have used table name as ORDERS Please changeaccordingly
Note
OR
OR