Sql Server Management Write Query View Minimum Value Row Row Table Minimum Value One Colum Q37092651

SQL Server Management

How can i write a query to view the minimum value row(and onlythat row) of a table where the minimum value in one column isdependent on another column

For example:

ftHkiRJkiRJkqMmhY0AAAAAAAAAMBdhIwAAAAAAA

I want to display the row with the lowest price with CategoryID1, but I want to create a seperate query with the lowest price fromCategoryID2


Solution


There are different ways you can achieve this using SQL.

1stMethod-

If you want two separate queries for selecting minimum value rowin each category id, use the below two queries. Sub query is usedin WHERE clause.

For CategoryID = 1

SELECT *

FROM TableName

WHERE Price = (SELECT

OR
OR

Leave a Comment

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