select a,b
from (
select a,b,row_number() over(partition by a order by b desc) as roworder
from myTable
) temp
where roworder = 1
More Related Contents:
- Add a column with a default value to an existing table in SQL Server
- NULL values inside NOT IN clause
- What is the best way to paginate results in SQL Server
- SQL MAX of multiple columns?
- Table Naming Dilemma: Singular vs. Plural Names [closed]
- Simplest way to do a recursive self-join?
- How can I convert bigint (UNIX timestamp) to datetime in SQL Server?
- How to calculate percentage with a SQL statement
- A table name as a variable
- How do you return the column names of a table?
- How to set table name in dynamic SQL query?
- TSQL PIVOT MULTIPLE COLUMNS
- INT vs Unique-Identifier for ID field in database
- SQL Server date format function
- Composite Primary key vs additional “ID” column?
- Fastest way to determine if record exists
- SQL – Query to get server’s IP address
- How to concatenate many rows with same id in sql?
- How do I edit a table in order to enable CASCADE DELETE?
- How to select date without time in SQL
- Generate nested nth level JSON SQL Server using recursive CTE
- Update query using Subquery in Sql Server
- “SELECT DISTINCT” ignores different cases
- T-SQL: checking for email format
- Database Naming Conventions by Microsoft?
- Functions vs Stored Procedures
- Convert date to YYYYMM format
- Combine Two Tables in Select (SQL Server 2008)
- T-SQL Conditional Order By
- Is there an Oracle equivalent to SQL Server’s OUTPUT INSERTED.*?