with 3 diff tables:
v_Collection tbl: CollectionID Name
1 walgreen
2 target
3 sears
v_FullCollectionMembership: CollectionID ResourceID isClient
1 100 1
2 200 1
3 300 0
v_image: ResourceID imageVersion
100 123
200 null
300 null
First sql:
select T1.Name, T2.ResourceID, count(T2.ResourceID) as Cnt_s1
from v_Collection as T1, v_FullCollectionMembership as T2
where T1.CollectionID = T2.CollectionID
group by T1.Name,T2.ResourceID
=> Name ResourceID rscIdCnt
walgreen 100 1
target 200 1
sears 300 1
Second sql:
select T1.Name, T2.ResourceID,count(T2.ResourceID) as Cnt_s2
from v_Collection as T1, v_FullCollectionMembership as T2
where T1.CollectionID = T2.CollectionID
and T2.IsClient='1'
group by T1.Name, T2.ResourceID
=> Name ResourceID rscIdCnt_s2
walgreen 100 1
target 200 1
Third sql:
select T1.Name, T2.ResourceID,count(T2.ResourceID) as Cnt_s3
from v_Collection as T1, v_FullCollectionMembership as T2, v_image as T3
where T1.CollectionID = T2.CollectionID
and T2.ResourceID = T3.ResourceID
and T3.imageVersion is not null
group by T1.Name, T2.ResourceID
=> Name ResourceID rscIdCnt_s2
walgreen 100 1
HOW CAN I COMBINE THESE RESULTS LIKE
=> Name ResourceID Cnt_S1 Cnt_s2 Cnt_s3
walgreen 100 1 1 1
target 200 1 1
sears 300 1
in t-sql
Thanks for your help....
v_Collection tbl: CollectionID Name
1 walgreen
2 target
3 sears
v_FullCollectionMembership: CollectionID ResourceID isClient
1 100 1
2 200 1
3 300 0
v_image: ResourceID imageVersion
100 123
200 null
300 null
First sql:
select T1.Name, T2.ResourceID, count(T2.ResourceID) as Cnt_s1
from v_Collection as T1, v_FullCollectionMembership as T2
where T1.CollectionID = T2.CollectionID
group by T1.Name,T2.ResourceID
=> Name ResourceID rscIdCnt
walgreen 100 1
target 200 1
sears 300 1
Second sql:
select T1.Name, T2.ResourceID,count(T2.ResourceID) as Cnt_s2
from v_Collection as T1, v_FullCollectionMembership as T2
where T1.CollectionID = T2.CollectionID
and T2.IsClient='1'
group by T1.Name, T2.ResourceID
=> Name ResourceID rscIdCnt_s2
walgreen 100 1
target 200 1
Third sql:
select T1.Name, T2.ResourceID,count(T2.ResourceID) as Cnt_s3
from v_Collection as T1, v_FullCollectionMembership as T2, v_image as T3
where T1.CollectionID = T2.CollectionID
and T2.ResourceID = T3.ResourceID
and T3.imageVersion is not null
group by T1.Name, T2.ResourceID
=> Name ResourceID rscIdCnt_s2
walgreen 100 1
HOW CAN I COMBINE THESE RESULTS LIKE
=> Name ResourceID Cnt_S1 Cnt_s2 Cnt_s3
walgreen 100 1 1 1
target 200 1 1
sears 300 1
in t-sql
Thanks for your help....