SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Not displaying 'double' information - way to group


Not displaying 'double' information - way to group

Author
Message
htilburgs
htilburgs
SSC Journeyman
SSC Journeyman (81 reputation)SSC Journeyman (81 reputation)SSC Journeyman (81 reputation)SSC Journeyman (81 reputation)SSC Journeyman (81 reputation)SSC Journeyman (81 reputation)SSC Journeyman (81 reputation)SSC Journeyman (81 reputation)

Group: General Forum Members
Points: 81 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?
Attachments
Query.png (13 views, 8.00 KB)
Results.png (12 views, 12.00 KB)
Wannahave.png (10 views, 3.00 KB)
GilaMonster
GilaMonster
SSC Guru
SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)

Group: General Forum Members
Points: 86240 Visits: 45232
Please post table definitions, sample data and desired output. Read this to see the best way to post this to get quick responses.
http://www.sqlservercentral.com/articles/Best+Practices/61537/

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


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search