<?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>Aaron Jefferson Villanueva&#039;s Blog Site&#187; MySQL</title>
	<atom:link href="http://malebolgia.shadowsonawall.net/category/code-programming/database/mysql/feed" rel="self" type="application/rss+xml" />
	<link>http://malebolgia.shadowsonawall.net</link>
	<description>Programming / Designing Blogging from windows to mac.</description>
	<lastBuildDate>Fri, 06 Aug 2010 02:40:24 +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>Cake Baking Models &#8211; Cannot see other tables</title>
		<link>http://malebolgia.shadowsonawall.net/code-programming/cake-baking-models-cannot-see-other-tables.html</link>
		<comments>http://malebolgia.shadowsonawall.net/code-programming/cake-baking-models-cannot-see-other-tables.html#comments</comments>
		<pubDate>Sun, 08 Nov 2009 02:57:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Coding/Programming]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[tabke]]></category>

		<guid isPermaLink="false">http://malebolgia.shadowsonawall.net/?p=131</guid>
		<description><![CDATA[
Problem.After I updated the database, I added 1 table; relate it to another table, and go to the command line to bake what I did, after typing "cake bake model" at the command prompt, I found out that the recently added table was not listed.

&#160;
Reason.Cake caches your model schema. Solution.1.) Clear your cache by deleting all files [...]]]></description>
			<content:encoded><![CDATA[
<p><strong><span style="color: #ff0000;">Problem.</span></strong><br />After I updated the database, I added 1 table; relate it to another table, and go to the command line to bake what I did, after typing "<span style="color: #993300;"><em>cake bake model</em></span>" at the command prompt, I found out that the recently added table was not listed.</p>
<p><a href="http://malebolgia.shadowsonawall.net/wp-content/uploads/2009/11/cake-table-large.jpg"><img class="size-full wp-image-130" title="Cake PHP Bake Model Problem" src="http://malebolgia.shadowsonawall.net/wp-content/uploads/2009/11/cake-table-smal.jpg" alt="Cake PHP Bake Model Problem" width="200" height="101" /></a></p>
<p>&nbsp;</p>
<p><strong><span style="color: #800000;">Reason.</span></strong><br />Cake caches your model schema. <br /><br /><strong><span style="color: #99cc00;">Solution.</span></strong><br />1.) <br />Clear your cache by deleting all files in your app's <strong><span style="color: #333300;"><span style="text-decoration: underline;">tmp/cache/models/</span></span></strong> <br /><span style="color: #333300;"><strong><span style="text-decoration: underline;">and tmp/cache/persistent/</span></strong></span><br /><br />2.) <br />Disable caching in your app's config/core.php // make sure to enable back again in production setup</p>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Turn off all caching application-wide.  *  
 */</span>  
Configure<span style="color: #339933;">::</span><span style="color: #004000;">write</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Cache.disable'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>



<p>After doing the solution, I can now successfully bake the new table.</p>
]]></content:encoded>
			<wfw:commentRss>http://malebolgia.shadowsonawall.net/code-programming/cake-baking-models-cannot-see-other-tables.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Right way to use sql&#8230;</title>
		<link>http://malebolgia.shadowsonawall.net/code-programming/right-way-to-use-sql-join-with-conditions-displaying-no-match-data.html</link>
		<comments>http://malebolgia.shadowsonawall.net/code-programming/right-way-to-use-sql-join-with-conditions-displaying-no-match-data.html#comments</comments>
		<pubDate>Tue, 03 Mar 2009 07:27:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Coding/Programming]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[MySql Join query]]></category>

		<guid isPermaLink="false">http://malebolgia.shadowsonawall.net/?p=55</guid>
		<description><![CDATA[Right way to use sql join with conditions (Displaying no match data). 

After hours trying to figure out what's wrong with my query for displaying list of cities with how many Lease/Sale were there. The problem was getting the cities even not yet added on Lease or Sale type, that means I need to list [...]]]></description>
			<content:encoded><![CDATA[<strong>Right way to use sql join with conditions (Displaying no match data). </strong><br />

After hours trying to figure out what's wrong with my query for displaying list of cities with how many Lease/Sale were there. The problem was getting the cities even not yet added on Lease or Sale type, that means I need to list cities that has no match yet or 0 count. <br /><br />


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$mainframe</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$ebconfig</span> <span style="color: #339933;">=</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$mainframe</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParams</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$prop_Type</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$ebconfig</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'prop_type'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Lease&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #000088;">$db_city</span> <span style="color: #339933;">=&amp;</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getDBO</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$query_city</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT t1.city, t1.id, COUNT( t2.propCity ) AS city_count
FROM #__listing_city AS t1
LEFT OUTER JOIN #__listing_listings AS t2 ON t2.propCity = t1.city
WHERE t2.propType = '<span style="color: #006699; font-weight: bold;">$prop_Type</span>' AND t2.published = 1
GROUP BY t1.city
ORDER BY t1.city ASC&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>



<br /><br />
The code above does not display the cities that has no match on another table. The where clause was giving the problem...
<br />


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$mainframe</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$ebconfig</span> <span style="color: #339933;">=</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$mainframe</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParams</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$prop_Type</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$ebconfig</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'prop_type'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Lease&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #000088;">$db_city</span> <span style="color: #339933;">=&amp;</span> JFactory<span style="color: #339933;">::</span><span style="color: #004000;">getDBO</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$query_city</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT t1.city, t1.id, COUNT( t2.propCity ) AS city_count
FROM #__listing_city AS t1
LEFT OUTER JOIN #__listing_listings AS t2 ON t2.propCity = t1.city
AND t2.published = 1 AND t2.propType = '<span style="color: #006699; font-weight: bold;">$prop_Type</span>'
GROUP BY t1.city
ORDER BY t1.city ASC&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>




<br /><br />

Instead putting the condition on "ON Clause" after the matching table condition, fixed the problem.]]></content:encoded>
			<wfw:commentRss>http://malebolgia.shadowsonawall.net/code-programming/right-way-to-use-sql-join-with-conditions-displaying-no-match-data.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Delete Duplicate Entries</title>
		<link>http://malebolgia.shadowsonawall.net/code-programming/18.html</link>
		<comments>http://malebolgia.shadowsonawall.net/code-programming/18.html#comments</comments>
		<pubDate>Thu, 19 Oct 2006 13:55:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Coding/Programming]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://malebolgia.shadowsonawall.net/?p=18</guid>
		<description><![CDATA[This Is the Best way to delete duplicate entries in MySQL
alter ignore table table_name add unique index(column_name);
For example your table_name.column_name has &#8220;some&#8221; duplicate entries the best way to do is to put unique index on the column_name that has duplicates
Is that simple.
]]></description>
			<content:encoded><![CDATA[<p>This Is the Best way to delete duplicate entries in MySQL</p>
<p>alter ignore table <em>table_name</em> add unique index(<em>column_name</em>);</p>
<p>For example your table_name.column_name has &#8220;some&#8221; duplicate entries the best way to do is to put unique index on the column_name that has duplicates</p>
<p>Is that simple.</p>
]]></content:encoded>
			<wfw:commentRss>http://malebolgia.shadowsonawall.net/code-programming/18.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
