title: How To Group By The Date Part Only In Doctrine
body: <p>I am trying to group my results by the date not the date time in doctrine. </p>
  
  <p>Here is my group by statement of my query: </p>
  
  <pre><code> GROUP BY CAST(fbaoh.datetimePlaced AS DATE) HAVING sqty &gt; 1 ORDER BY fbaoh.datetimePlaced DESC
  </code></pre>
  
  <p>This works in MySQL but not in Doctrine, what am I doing wrong? </p>
  
  <p>Here is the error I get: </p>
  
  <pre><code> Error: Cannot group by undefined identification or result variable. (500 Internal Server Error)
  </code></pre>
  
  <p>Thanks!</p>
  
  <p>Here is my entire query: </p>
  
  <pre><code>$query = $em-&gt;createQuery("
  SELECT fbaoh, fbaoh.id as fbaohid, sum(fbaoh.qty) as sqty, p.id, p.name
  FROM WIC\APIBundle\Entity\FBAOrderHistory fbaoh
  LEFT JOIN WIC\ListingBundle\Entity\ListingAmazon la
  WITH fbaoh.asin = la.standardProductIdValue
  LEFT JOIN WIC\ListingBundle\Entity\Listing l
  WITH fbaoh.sku = l.product_identifier
  LEFT JOIN WIC\ProductBundle\Entity\Product p
  WITH l.product = p.id
  LEFT JOIN WIC\ListingBundle\Entity\ListingChannel lc
  WITH l.listingChannel = lc.id
  WHERE fbaoh.webServiceAccountAmazon = lc.webServiceAccount
  AND fbaoh.sku = :sku
  AND l.id = la.id
  AND p.id != ''
  GROUP BY CAST(fbaoh.datetimePlaced AS DATE) HAVING sqty &gt; 1 ORDER BY fbaoh.datetimePlaced DESC
  ");
  </code></pre>