<?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>PHPLAMP网站建设 &#187; DISTINCT</title>
	<atom:link href="http://www.phplamp.org/tag/distinct/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phplamp.org</link>
	<description>PHPLAMP提供保定网站建设，网站推广优化服务。</description>
	<lastBuildDate>Tue, 31 Aug 2010 09:56:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CakePHP DISTINCT 查询唯一记录</title>
		<link>http://www.phplamp.org/2009/05/cakephp-distinct-findall-paginate/</link>
		<comments>http://www.phplamp.org/2009/05/cakephp-distinct-findall-paginate/#comments</comments>
		<pubDate>Thu, 21 May 2009 10:45:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[框架学习]]></category>
		<category><![CDATA[DISTINCT]]></category>
		<category><![CDATA[PHP框架]]></category>

		<guid isPermaLink="false">http://www.phplamp.org/?p=305</guid>
		<description><![CDATA[用CakePHP一般都是进行一些普通的查询操作，当涉及到唯一性查询的时候着时记我费了一些头脑，找了很多资料都没能解决，国内更是一些有价值的资料没有。还是在国外的网站上找到了些蛛丝马迹。
假如项目中用的是findAll查询，若要查询唯一记录可以这样写：
$this-&#62;Model-&#62;findAll(null, &#8216;DISTINCT Model.*&#8217;);
若项目中用了CakePHP1.2的paginate组件，查询唯一记录可以这样写：
$this-&#62;paginate['fields'] = array(&#8216;DISTINCT Model.*&#8217;);
$this-&#62;set(&#8216;contents&#8217;, $this-&#62;paginate());
]]></description>
			<content:encoded><![CDATA[<p>用CakePHP一般都是进行一些普通的查询操作，当涉及到<strong>唯一性查询</strong>的时候着时记我费了一些头脑，找了很多资料都没能解决，国内更是一些有价值的资料没有。还是在国外的网站上找到了些蛛丝马迹。</p>
<p>假如项目中用的是<strong>findAll查询</strong>，若要查询唯一记录可以这样写：</p>
<blockquote><p>$this-&gt;Model-&gt;findAll(null, &#8216;DISTINCT Model.*&#8217;);</p></blockquote>
<p>若项目中用了CakePHP1.2的<strong>paginate组件</strong>，查询唯一记录可以这样写：</p>
<blockquote><p>$this-&gt;paginate['fields'] = array(&#8216;DISTINCT Model.*&#8217;);</p>
<p>$this-&gt;set(&#8216;contents&#8217;, $this-&gt;paginate());</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.phplamp.org/2009/05/cakephp-distinct-findall-paginate/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
