﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server Newbies  / Group by and Where clause / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 22 May 2013 04:39:01 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Group by and Where clause</title><link>http://www.sqlservercentral.com/Forums/Topic1425968-1292-1.aspx</link><description>[url]http://sqlblog.com/blogs/paul_white/archive/2012/03/12/fun-with-aggregates.aspx[/url]</description><pubDate>Mon, 04 Mar 2013 00:43:34 GMT</pubDate><dc:creator>GilaMonster</dc:creator></item><item><title>RE: Group by and Where clause</title><link>http://www.sqlservercentral.com/Forums/Topic1425968-1292-1.aspx</link><description>Thanks for your reply Jeff.I got clear pic .. thanks a lot...one more doubt Jeff,both the condition table is empty,then why the where condition returns 'null'and group by condition returns nothing.can you plz explain me ?</description><pubDate>Sun, 03 Mar 2013 23:04:47 GMT</pubDate><dc:creator>sanandh87</dc:creator></item><item><title>RE: Group by and Where clause</title><link>http://www.sqlservercentral.com/Forums/Topic1425968-1292-1.aspx</link><description>In the first query, you give SQL Server no choice.  You say to find the MAX unconditionally for the given criteria and there isn't one so it returns a NULL.In the second query, it's different.  You're saying find the MAX for a given group which is actually a condition.  There are no groups that match your criteria so it returns nothing.</description><pubDate>Sun, 03 Mar 2013 20:33:34 GMT</pubDate><dc:creator>Jeff Moden</dc:creator></item><item><title>Group by and Where clause</title><link>http://www.sqlservercentral.com/Forums/Topic1425968-1292-1.aspx</link><description>Hi,Please see below, Table name : Log_tableColumns: Logid int, databasename varchar(30), tablename varchar(30), logdate datetimeQuery 1:            Select max(logdate) from log_table            where databasename='db1' and tablename='table1';consider the Log_table is empty, when I execute Query 1, the result will be 'Null'.Query 2 :            select max(logdate) from log_table            Where databasename='db1' and tablename='table1'            group by databasename,tablename;Consider the log_table is empty, when I execute Query 2, the result will be empty.Note : both the condition table is empty.Please explain me what happening inside and why the result different?</description><pubDate>Sun, 03 Mar 2013 09:47:06 GMT</pubDate><dc:creator>sanandh87</dc:creator></item></channel></rss>