Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Not displaying 'double' information - way to group Expand / Collapse
Posted Monday, June 22, 2009 5:23 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, November 10, 2011 2:27 AM
Points: 53, Visits: 215
I've question about the filtering of results of a query

Image Query.png shows the query
Image Results.pngshows the results of the query
Image Wannahave.png shows how I like to have this

Explanation (this example):
Data from two databases are combined and give result (or NULL if not exists)
Because there are 3 results for Description, Status and Score (PURPLE), the results for Customer, Contract, Component_Value (BLUE) are repeated.

I'dd like the results where Component Value is summed (added together), but only for the 4 original value's and not for all the component values because everything is tripled.

I've tried several things, but no luck.
Can somebody give me a hand?

  Post Attachments 
Query.png (8 views, 8.23 KB)
Results.png (8 views, 12.35 KB)
Wannahave.png (8 views, 3.31 KB)
Post #739294
Posted Monday, June 22, 2009 7:32 AM



Group: General Forum Members
Last Login: Today @ 5:18 AM
Points: 45,619, Visits: 44,147
Please post table definitions, sample data and desired output. Read this to see the best way to post this to get quick responses.

It would be far more useful if you could post the info as text, not images. I can't copy the query from an image to modify it.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #739367
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse