title: How do I make this NHibernate QueryOver query return rows for empty groups
body: <p>The following NHibernate QueryOver query is counting the number of applications for each month, within a given date range.</p>
  
  <p>However, I don't get any results for months that don't have any applications in them but I want to actually have Count = 0 returned for those months.</p>
  
  <p>So how would I change the query to return a row as well for months that don't have any applications in them?</p>
  
  <pre><code>DateTimeOffset endDate = DateTimeOffset.Now;
  DateTimeOffset startDate = endDate.AddMonths(-12);
  
  var result = Session.QueryOver&lt;Application&gt;()
      .WhereRestrictionOn(c =&gt; c.SubmissionDate).IsBetween(startDate).And(endDate)
      .SelectList(list =&gt; list
          .Select(Projections.SqlGroupProjection(
              "YEAR(SubmissionDate) As [Year]",
              "YEAR(SubmissionDate)",
              new[] { "YEAR" },
              new IType[] { NHibernateUtil.Int32 }))
          .Select(Projections.SqlGroupProjection(
              "MONTH(SubmissionDate) As [Month]",
              "MONTH(SubmissionDate)",
              new[] { "MONTH" },
              new IType[] { NHibernateUtil.Int32 }))
          .SelectCount(x =&gt; x.Id))
      .OrderBy(Projections.SqlFunction(
          "YEAR",
          NHibernateUtil.Int32,
          Projections.Property&lt;Application&gt;(item =&gt; item.SubmissionDate))).Asc
      .ThenBy(Projections.SqlFunction(
          "MONTH",
          NHibernateUtil.Int32,
          Projections.Property&lt;Application&gt;(item =&gt; item.SubmissionDate))).Asc
      .List&lt;object[]&gt;()
      .Select(n =&gt; new
      {
          Year = n[0],
          Month = n[1],
          Count = (int)n[2]
      }));
  </code></pre>