I have 3 select queries:
Query 1:
select MMBID, MMBStartDate, MMBEnddate from MMBT1, MMBT2
where MMBT1.Profile_ID = MMBT2.Profile_ID
Query 2:
(SELECT Profile_ID, COUNT(vp.Viewed_ProfileId) AS viewed FROM dbo.Viewed_Profiles vp
GROUP BY vp.Profile_Id),
Query 3:
SELECT Profile_ID, COUNT(fp.Favorite_ProfileId) AS favorites FROM dbo.Favorite_Profiles fp
GROUP BY fp.Profile_Id
Now how I combine all these 3 select sts and get the follwing columns as output
- from Query1:
MMBID, MMBStartDate, MMBEnddate - from query2:
COUNT(vp.Viewed_ProfileId) AS viewed - from Query3:
COUNT(fp.Favorite_ProfileId) AS favorites
Thanks for ur help
Sun
(SELECT Profile_ID, COUNT(vp.Viewed_ProfileId) AS viewed FROM dbo.Viewed_Profiles vp
GROUP BY vp.Profile_Id),
(SELECT Profile_ID, COUNT(fp.Favorite_ProfileId) AS favorites FROM dbo.Favorite_Profiles fp
GROUP BY fp.Profile_Id
)
1 Answer