Reputation: 151
This is a SQL Server question
I have 3 records with data: (the fields filled with dots are empty!)
NAME | FIELD1 | FIELD2 | FIELD3
blabla | . | b | .
blabla | a | . | .
blabla | . | . | c
Now I want the output to show just one row like this:
blabla | a | b | c
I'm not sure if it has to be a Case or Group or what else
How can i accomplish this?
Upvotes: 4
Views: 114
Reputation: 25763
You can use aggregate function for example max
select name,max(FIELD1) as FIELD1, max(FIELD2) as FIELD2, max(FIELD3) as FIELD3
from tab
group by name
Upvotes: 9