Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 10045

how to combine group? rows if same contact

$
0
0

hi all, 

i have the following t-sql query

SELECT  
FilteredContact.contactid, 
FilteredContact.fullname, 
FilteredContact.birthdate, 
FilteredConnection.record2roleidname,
FilteredConnection.record1idname

FROM         
FilteredContact left JOIN
FilteredConnection ON FilteredContact.contactid = FilteredConnection.record2id 
						
WHERE
(FilteredConnection.statuscode = 1) AND
(FilteredConnection.record1id IN (@contactid,@partnerid)) AND 
(FilteredConnection.record2id = FilteredContact.contactid) AND
(FilteredConnection.record2roleidname in ('son','daugther'))

ORDER BY FilteredContact.fullname DESC

and if i get 2 rows because the result matches for record1id = @contactid and for record1id = @partnerid, then i only want to get 1 resultrow with as 'common child'

Do i have to use a condition in select, or group by, or union?

THX Greets Pit


Viewing all articles
Browse latest Browse all 10045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>