<?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>axing's blog &#187; Programming</title>
	<atom:link href="http://xing.web.id/blog/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://xing.web.id/blog</link>
	<description>Renew, reload, re-新の空</description>
	<lastBuildDate>Wed, 24 Jun 2009 13:14:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Another way of joining table without JOIN syntax in SQL</title>
		<link>http://xing.web.id/blog/2009/04/another-way-of-joining-table-without-join-syntax-in-sql/</link>
		<comments>http://xing.web.id/blog/2009/04/another-way-of-joining-table-without-join-syntax-in-sql/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 04:54:43 +0000</pubDate>
		<dc:creator>axing</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Tips & Tricks]]></category>

		<guid isPermaLink="false">http://xing.web.id/blog/?p=116</guid>
		<description><![CDATA[We often use JOIN syntax for joining 2 or more tables in SQL. Such as INNER JOIN, OUTER JOIN, etc. But here I found another way of joining table that much like INNER JOIN, that is by tricking WHERE syntax.
Below is the example of INNER JOIN between table Customer and Member:

SELECT customer.name, member.name
FROM customer INNER [...]]]></description>
			<content:encoded><![CDATA[<p>We often use JOIN syntax for joining 2 or more tables in SQL. Such as INNER JOIN, OUTER JOIN, etc. But here I found another way of joining table that much like INNER JOIN, that is by tricking WHERE syntax.</p>
<p>Below is the example of INNER JOIN between table Customer and Member:</p>
<div class="code-snippet">
<pre class="sql"><span style="color: #993333; font-weight: bold;">SELECT</span> customer.name, member.name</pre>
<pre class="sql"><span style="color: #993333; font-weight: bold;">FROM</span> customer <span style="color: #993333; font-weight: bold;">INNER</span> <span style="color: #993333; font-weight: bold;">JOIN</span> member</pre>
<pre class="sql">     <span style="color: #993333; font-weight: bold;">ON</span> customer.member_id = member.id</pre>
</div>
<p>Here is the magic of using WHERE syntax:</p>
<div class="code-snippet">
<pre class="sql"><span style="color: #993333; font-weight: bold;">SELECT</span> customer.name, member.name</pre>
<pre class="sql"><span style="color: #993333; font-weight: bold;">FROM</span> customer, member</pre>
<pre class="sql"><span style="color: #993333; font-weight: bold;">WHERE</span> customer.member_id = member.id</pre>
</div>
<p>Though the syntax doesn't look shorter enough, but it will be very handy for some SQL statement that joins a lot of tables.</p>
<p>This trick works fine with <a href="http://www.mysql.com/">MySQL</a> and <a href="http://hsqldb.org/">HSQLDB</a>. I haven't tried on another engine yet.</p>
<p>Tell me if i made a mistake. <img src='http://xing.web.id/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  thanks</p>
]]></content:encoded>
			<wfw:commentRss>http://xing.web.id/blog/2009/04/another-way-of-joining-table-without-join-syntax-in-sql/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP: Convert If to Switch</title>
		<link>http://xing.web.id/blog/2008/12/php-convert-if-to-switch/</link>
		<comments>http://xing.web.id/blog/2008/12/php-convert-if-to-switch/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 14:37:52 +0000</pubDate>
		<dc:creator>axing</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips & Tricks]]></category>

		<guid isPermaLink="false">http://xing.web.id/blog/?p=72</guid>
		<description><![CDATA[I have been being asked by some friends of mine, that is in PHP language how to convert If statement into Switch statement (in some cases, using Switch is for shortening code).
At first, I thought that Switch was just only for 'equal' comparison. But actually it is more than just equal. So I did a [...]]]></description>
			<content:encoded><![CDATA[<p>I have been being asked by some friends of mine, that is in PHP language how to convert <strong>If </strong>statement into <strong>Switch </strong>statement (in some cases, using Switch is for shortening code).</p>
<p>At first, I thought that Switch was just only for 'equal' comparison. But actually it is more than just equal. So I did a search, and I found there is a way that can code Switch just like If. Well, I'm lazy to explain, so let's see the following sample codes of getting Grade from Score:</p>
<p>If statement:</p>
<div class="code-snippet">
<pre class="php"><span style="color: #0000ff;">$score</span>=<span style="color: #cc66cc;">78</span>;</pre>
<pre class="php"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$score</span>&gt;=<span style="color: #cc66cc;">85</span><span style="color: #66cc66;">&#41;</span>: <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;Grade A&quot;</span>;</pre>
<pre class="php"><span style="color: #b1b100;">elseif</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$score</span>&gt;=<span style="color: #cc66cc;">70</span><span style="color: #66cc66;">&#41;</span>: <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;Grade B&quot;</span>;</pre>
<pre class="php"><span style="color: #b1b100;">elseif</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$score</span>&gt;=<span style="color: #cc66cc;">55</span><span style="color: #66cc66;">&#41;</span>: <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;Grade C&quot;</span>;</pre>
<pre class="php"><span style="color: #b1b100;">elseif</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$score</span>&gt;=<span style="color: #cc66cc;">40</span><span style="color: #66cc66;">&#41;</span>: <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;Grade D&quot;</span>;</pre>
<pre class="php"><span style="color: #b1b100;">else</span>: <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;Grade E&quot;</span>;</pre>
<pre class="php"><span style="color: #b1b100;">endif</span>;</pre>
</div>
<p>Switch statement:</p>
<div class="code-snippet">
<pre class="php"><span style="color: #0000ff;">$score</span>=<span style="color: #cc66cc;">78</span>;</pre>
<pre class="php"><span style="color: #b1b100;">switch</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></pre>
<pre class="php">  <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">$score</span>&gt;=<span style="color: #cc66cc;">85</span>: <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;Grade A&quot;</span>; <span style="color: #b1b100;">break</span>;</pre>
<pre class="php">  <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">$score</span>&gt;=<span style="color: #cc66cc;">70</span>: <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;Grade B&quot;</span>; <span style="color: #b1b100;">break</span>;</pre>
<pre class="php">  <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">$score</span>&gt;=<span style="color: #cc66cc;">55</span>: <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;Grade C&quot;</span>; <span style="color: #b1b100;">break</span>;</pre>
<pre class="php">  <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">$score</span>&gt;=<span style="color: #cc66cc;">40</span>: <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;Grade D&quot;</span>; <span style="color: #b1b100;">break</span>;</pre>
<pre class="php">  <span style="color: #000000; font-weight: bold;">default</span>: <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;Grade E&quot;</span>;</pre>
<pre class="php"><span style="color: #66cc66;">&#125;</span></pre>
</div>
<p>Both code produces same result, that is "Grade B". <img src='http://xing.web.id/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://xing.web.id/blog/2008/12/php-convert-if-to-switch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
