sql server query grouping

I have a query that is returning the following data.  

Broward County     07DB-3V-11-16-01-Z 08   596000531    Buyouts    Null          Null
Broward County     07DB-3V-11-16-01-Z 08   596000531    Null          Null          Buyouts

I would like to group it up to just show one line that looks like :

Broward County     07DB-3V-11-16-01-Z 08   596000531    Buyouts     Null     Buyouts

Thanks in advance.
PaulconsultingAsked:
Who is Participating?
 
PaulconsultingAuthor Commented:
I resolved it, I inserted the results into a Temp table then joined on itself.
0
 
Kishan ZunjareSr. Software EngineerCommented:
Here you can use Group By clause in SQL to combine result, you can apply group by on selected columns
0
 
PaulconsultingAuthor Commented:
Grouping doesn't work for me in this scenario, at least not that I can tell.  Do you have a query in mind?
0
 
Scott PletcherSenior DBACommented:
SELECT name, id1, id2, MAX(buyout1) AS buyout1, MAX(buyout2) AS buyout2, MAX(buyout3)  AS buyout3
FROM ...
GROUP BY name, id1, id2


Corresponds to sample data like this:
name = Broward County
id1 = 07DB-3V-11-16-01-Z 08
id2 = 596000531
buyout1 = Buyouts
buyout2 = Null
buyout3 = Null
...
buyout1 = Null
buyout2 = Null
buyout3 = Buyouts
0
 
PaulconsultingAuthor Commented:
I resolved it, I inserted the results into a Temp table then joined on itself.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.