Sql Server Management Query Write Display Entire Row Row Table Highest Number 1 Column Spe Q37046288

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:

DytqGaYeJudWAAAAAElFTkSuQmCC

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

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.