One method is aggregation:
select col1, col2, max(col3), max(col4)
from t
group by col1, col2;
For your sample data it is easier to just filter out NULL
values:
select t.*
from t
where col3 is not null;
More Related Contents:
- I dont know sql syntax for my table [closed]
- Identity increment is jumping in SQL Server database
- SQL Server 2012 column identity increment jumping from 6 to 1000+ on 7th entry [duplicate]
- get a comma delimited string from rows [duplicate]
- T-SQL – Insert Data into Parent and Child Tables
- Identity column value suddenly jumps to 1001 in sql server [duplicate]
- Default row order in SELECT query – SQL Server 2008 vs SQL 2012
- Scope of temporary tables in SQL Server
- Sequence vs identity
- Count Number of Consecutive Occurrence of values in Table
- Get previous and next row from rows selected with (WHERE) conditions
- Convert Date format into DD/MMM/YYYY format in SQL Server
- Replace first occurrence of substring in a string in SQL
- Can SQL Server Express LocalDB be connected to remotely?
- How to correctly insert newline in nvarchar [duplicate]
- Find min and max for subsets of consecutive rows – gaps and islands
- Group All Related Records in Many to Many Relationship, SQL graph connected components
- The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions
- How to subtract 30 days from the current date using SQL Server
- Cannot Resolve Collation Conflict
- Try_Convert for SQL Server 2008 R2
- How to get Previous Value for Null Values
- Can’t create stored procedure with table output parameter
- SQL Server: +(unary) operator on non-numeric Strings
- How to automatically generate unique id in SQL like UID12345678?
- Is there a combination of “LIKE” and “IN” in SQL?
- Inserting rows into a table with one IDENTITY column only [duplicate]
- How to retrieve field names from temporary table (SQL Server 2008)
- How do I change db schema to dbo
- How to insert into a table with just one IDENTITY column?