<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>最优良人 &#187; group by</title>
	<atom:link href="http://www.zui88.com/view-tag/group-by/feed" rel="self" type="application/rss+xml" />
	<link>http://www.zui88.com/blog</link>
	<description>中山php&#124;最优网络</description>
	<lastBuildDate>Mon, 13 May 2013 04:56:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Mysql Having的用法：对group by之后的分组加限制条件</title>
		<link>http://www.zui88.com/blog/view-88.html</link>
		<comments>http://www.zui88.com/blog/view-88.html#comments</comments>
		<pubDate>Sat, 13 Aug 2011 18:27:50 +0000</pubDate>
		<dc:creator>lin</dc:creator>
				<category><![CDATA[数据库]]></category>
		<category><![CDATA[group by]]></category>
		<category><![CDATA[having]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.zui88.com/blog/?p=88</guid>
		<description><![CDATA[在使用聚合函数之前，我们可以通过where对查询加限制条件，那么如果在group by之后我们要对分组里面的数据再加限制条件怎么办呢？答案是having。 HAVING子句可以让我们筛选成组后的各组数据． WHERE子句在聚合前先筛选记录．也就是说作用在GROUP BY 子句和HAVING子句前． 而 HAVING子句在聚合后对组记录进行筛选。 having子句出现的数据必须在group by 之后，order by 之后 例如在上一篇中对name按照出现次数排序之后，我们还想只查出名字里面含有lin的数据，可以这样写： select name ,count(*) from data group by name having name like '%lin%' order by couny(*) DESC]]></description>
			<content:encoded><![CDATA[<div style="line-height: 25px;">
<p>在使用聚合函数之前，我们可以通过where对查询加限制条件，那么如果在group by之后我们要对分组里面的数据再加限制条件怎么办呢？答案是having。</p>
<p>HAVING子句可以让我们筛选成组后的各组数据．<br />
WHERE子句在聚合前先筛选记录．也就是说作用在GROUP BY 子句和HAVING子句前．<br />
而 HAVING子句在聚合后对组记录进行筛选。</p>
<p>having子句出现的数据必须在group by 之后，order by 之后</p>
<p>例如在上一篇中对name按照出现次数排序之后，我们还想只查出名字里面含有lin的数据，可以这样写：</p>
<p>select name ,count(*)  from data group by name having name like '%lin%' order by couny(*) DESC</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.zui88.com/blog/view-88.html/feed</wfw:commentRss>
		<slash:comments>683</slash:comments>
		</item>
	</channel>
</rss>
