Firstly, you should verify/cross-check your post before posting it in any forum, this will say a lot of time of posters.
Secondly, here is the solution to your query (note that, I could have posted this in my last post only, but the listed output has caused me to wait...)
DECLARE @tblMonthYear TABLE
(
GUID INT,
YearName VARCHAR(10),
Quarter VARCHAR(2),
MonthYear VARCHAR(10),
MonthDay INT
)
INSERT @tblMonthYear
SELECT 1,'08/09','Q4','Jan-09',1 UNION ALL
SELECT 2,'08/09','Q4','Jan-09',2 UNION ALL
SELECT 3,'08/09','Q4','Jan-09',3
DECLARE @tblProject TABLE
(
ProjectID INT,
ProjectTitle VARCHAR(10),
TaskTitle VARCHAR(10),
Milestone INT,
MonthYear VARCHAR(10),
MonthDay INT
)
INSERT @tblProject
SELECT 63,'Arsenal',NULL,NULL,NULL,NULL UNION ALL
SELECT 69,'COEP','Start',1,'Jan-09',1 UNION ALL
SELECT 69,'COEP','Start',1,'Jan-09',2
--SELECT * FROM @tblMonthYear
--SELECT * FROM @tblProject
SELECTAP.GUID, AP.ProjectID, COUNT( P.ProjectID ) AS Milestone
FROM(
SELECTMY.GUID, MY.MonthYear, MY.MonthDay, P.ProjectID
FROM@tblMonthYear MY
CROSS JOIN
(
SELECTDISTINCT ProjectID
FROM@tblProject
) P
) AP
LEFT JOIN @tblProject P ON AP.ProjectID = P.ProjectID AND AP.MonthYear = P.MonthYear AND AP.MonthDay = P.MonthDay
GROUP BY AP.GUID, AP.ProjectID
--Ramesh