<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: MsSQL GROUP BY DATE</title>
	<atom:link href="http://www.alexle.net/archives/132/feed" rel="self" type="application/rss+xml" />
	<link>http://alexle.net/archives/132</link>
	<description>Personal View</description>
	<pubDate>Tue, 07 Feb 2012 07:22:29 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
		<item>
		<title>By: Richard</title>
		<link>http://alexle.net/archives/132#comment-326597</link>
		<dc:creator>Richard</dc:creator>
		<pubDate>Fri, 03 Dec 2010 21:19:49 +0000</pubDate>
		<guid isPermaLink="false">http://alexle.net/archives/132#comment-326597</guid>
		<description>yeah, but

SELECT UserName convert(char(10),DateTimeColumn ,111) as groupDate, Count(*) as hits FROM someTable
GROUP BY UserName, convert(char(10),DateTimeColumn ,111)

is the same as 

SELECT UserName convert(char(10),DateTimeColumn ,111) as groupDate, Count(*) as hits FROM someTable
GROUP BY UserName, DateTimeColumn

as the convert in the GRUP BY does not really group by that dateformat. (111, whatever that means..).. so the magic is really in the select..

for example try some crazy substringing around your group by to make it nonexistent like:

SUBSTRING(Convert(varchar(max), DateTimeColumn, 103), 0, 0)

it will still do the group by DateTimeColumn, it is the select format that makes the difference!!

Whhhhhhatttttt!</description>
		<content:encoded><![CDATA[<p>yeah, but</p>
<p>SELECT UserName convert(char(10),DateTimeColumn ,111) as groupDate, Count(*) as hits FROM someTable<br />
GROUP BY UserName, convert(char(10),DateTimeColumn ,111)</p>
<p>is the same as </p>
<p>SELECT UserName convert(char(10),DateTimeColumn ,111) as groupDate, Count(*) as hits FROM someTable<br />
GROUP BY UserName, DateTimeColumn</p>
<p>as the convert in the GRUP BY does not really group by that dateformat. (111, whatever that means..).. so the magic is really in the select..</p>
<p>for example try some crazy substringing around your group by to make it nonexistent like:</p>
<p>SUBSTRING(Convert(varchar(max), DateTimeColumn, 103), 0, 0)</p>
<p>it will still do the group by DateTimeColumn, it is the select format that makes the difference!!</p>
<p>Whhhhhhatttttt!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.181 seconds -->

