Solved

sql server query grouping

Posted on 2014-03-12
5
121 Views
Last Modified: 2014-03-18
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.
0
Comment
Question by:Paulconsulting
  • 3
5 Comments
 
LVL 7

Expert Comment

by:Kishan Zunjare
ID: 39925592
Here you can use Group By clause in SQL to combine result, you can apply group by on selected columns
0
 

Author Comment

by:Paulconsulting
ID: 39926221
Grouping doesn't work for me in this scenario, at least not that I can tell.  Do you have a query in mind?
0
 

Accepted Solution

by:
Paulconsulting earned 0 total points
ID: 39926311
I resolved it, I inserted the results into a Temp table then joined on itself.
0
 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 39927814
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
 

Author Closing Comment

by:Paulconsulting
ID: 39936368
I resolved it, I inserted the results into a Temp table then joined on itself.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question