Blog Details

Sql join from the same table


                                
                                    here you need to use alias name....

<code><a href="http://192.168.1.111/phpmyadmin/url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.5%2Fen%2Fselect.html&amp;token=1f36f3ef1f79485032b4840370080375" target="mysql_doc">SELECT</a> a.id, a.name, a.tag_id, b.name AS tag_name
FROM tags AS a
<a href="http://192.168.1.111/phpmyadmin/url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.5%2Fen%2Fstring-functions.html%23function_left&amp;token=1f36f3ef1f79485032b4840370080375" target="mysql_doc">LEFT</a> JOIN tags AS b ON a.tag_id <a href="http://192.168.1.111/phpmyadmin/url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.5%2Fen%2Fcomparison-operators.html%23operator_equal&amp;token=1f36f3ef1f79485032b4840370080375" target="mysql_doc">=</a> b.id
ORDER BY a.tag_id DESC</code>
                                    


Categories

Php mysql

Latest posts

13.05.14
Implementing CRUD Operations ΒΆ

<ul> <li>Now comes the fun part. We would like t

13.05.14
View

<ol> <li><a href="http://www.yiiframework.com/do

13.05.14
Creating Model

<ol> <li><a href="http://www.yiiframework.com/do

Get Free Quote