Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

In Organisation Hierarchy want to know if more then one sales rep

$
0
0

Hi All,

I have this table

SELECT       dbo.org_tree.org_id
,dbo.org_tree.parent_id
,dbo.org_tree.isleaf
,dbo.org.company_name
                          descendent_count
            ancestor_count
            ,dbo.org.sid2_id
            ,dbo.org.reporting_level 
            ,dbo.org.sales_rep_id
FROM         dbo.org

if organisation 1 is a a reporting level and it or its descendants do not have the same rep assigned then I want a list of all the organisations which are reporting level 1 along with all their descendants if sales rep is different like the following table


MH


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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