Link to home
Start Free TrialLog in
Avatar of Paulconsulting
Paulconsulting

asked on

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.
Avatar of Kishan Zunjare
Kishan Zunjare
Flag of Australia image

Here you can use Group By clause in SQL to combine result, you can apply group by on selected columns
Avatar of Paulconsulting
Paulconsulting

ASKER

Grouping doesn't work for me in this scenario, at least not that I can tell.  Do you have a query in mind?
ASKER CERTIFIED SOLUTION
Avatar of Paulconsulting
Paulconsulting

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Scott Pletcher
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
I resolved it, I inserted the results into a Temp table then joined on itself.