SELECT dbo.SubscriptionDetail.OwnerId, dbo.SubscriptionDetail.ISO2Char, dbo.SubscriptionDetail.BillingId, dbo.SubscriptionDetail.IssueNo, YEAR(dbo.SubscriptionRegistration.DateSubscribe) AS Yrs, MONTH(dbo.SubscriptionRegistration.DateSubscribe) AS Mth, LTRIM(STR(YEAR(dbo.SubscriptionRegistration.DateSubscribe))) + '-' + LTRIM(STR(MONTH(dbo.SubscriptionRegistration.DateSubscribe))) + '-1' AS DateSubscribe, COUNT(dbo.SubscriptionDetail.Id) AS Total FROM dbo.SubscriptionDetail INNER JOIN dbo.SubscriptionRegistration ON dbo.SubscriptionDetail.ActivationId = dbo.SubscriptionRegistration.Id GROUP BY dbo.SubscriptionDetail.OwnerId, dbo.SubscriptionDetail.ISO2Char, dbo.SubscriptionDetail.BillingId, dbo.SubscriptionDetail.IssueNo, YEAR(dbo.SubscriptionRegistration.DateSubscribe), MONTH(dbo.SubscriptionRegistration.DateSubscribe), LTRIM(STR(YEAR(dbo.SubscriptionRegistration.DateSubscribe))) + '-' + LTRIM(STR(MONTH(dbo.SubscriptionRegistration.DateSubscribe))) + '-1' HAVING (dbo.SubscriptionDetail.OwnerId = 109) AND (dbo.SubscriptionDetail.ISO2Char = N'SG') AND (dbo.SubscriptionDetail.BillingId IS NULL) AND (dbo.SubscriptionDetail.IssueNo = 1);