<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: PHP MySQL Order by Two Columns</title>
	<atom:link href="http://newsourcemedia.com/blog/php-mysql-order-by-two-columns/feed/" rel="self" type="application/rss+xml" />
	<link>http://newsourcemedia.com/blog/php-mysql-order-by-two-columns/</link>
	<description>Focused on Interactive Design, Development and Marketing</description>
	<lastBuildDate>Tue, 07 Feb 2012 08:42:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Mouli</title>
		<link>http://newsourcemedia.com/blog/php-mysql-order-by-two-columns/comment-page-1/#comment-689</link>
		<dc:creator>Mouli</dc:creator>
		<pubDate>Mon, 29 Aug 2011 16:53:08 +0000</pubDate>
		<guid isPermaLink="false">http://newsourcemedia.com/blog/1969/12/31/php-mysql-order-by-two-columns/#comment-689</guid>
		<description>Thanks... Its Working...</description>
		<content:encoded><![CDATA[<p>Thanks&#8230; Its Working&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: plr store</title>
		<link>http://newsourcemedia.com/blog/php-mysql-order-by-two-columns/comment-page-1/#comment-654</link>
		<dc:creator>plr store</dc:creator>
		<pubDate>Thu, 23 Jun 2011 09:36:05 +0000</pubDate>
		<guid isPermaLink="false">http://newsourcemedia.com/blog/1969/12/31/php-mysql-order-by-two-columns/#comment-654</guid>
		<description>Hello can&#039;t we use ORDER BY DESC when using two column names?
like 

ORDER BY column1, column2 DESC

it doesnt work.</description>
		<content:encoded><![CDATA[<p>Hello can&#8217;t we use ORDER BY DESC when using two column names?<br />
like </p>
<p>ORDER BY column1, column2 DESC</p>
<p>it doesnt work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: prakash</title>
		<link>http://newsourcemedia.com/blog/php-mysql-order-by-two-columns/comment-page-1/#comment-574</link>
		<dc:creator>prakash</dc:creator>
		<pubDate>Tue, 01 Feb 2011 21:19:57 +0000</pubDate>
		<guid isPermaLink="false">http://newsourcemedia.com/blog/1969/12/31/php-mysql-order-by-two-columns/#comment-574</guid>
		<description>Thanks a lot boss.</description>
		<content:encoded><![CDATA[<p>Thanks a lot boss.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: prakash</title>
		<link>http://newsourcemedia.com/blog/php-mysql-order-by-two-columns/comment-page-1/#comment-573</link>
		<dc:creator>prakash</dc:creator>
		<pubDate>Tue, 01 Feb 2011 21:19:06 +0000</pubDate>
		<guid isPermaLink="false">http://newsourcemedia.com/blog/1969/12/31/php-mysql-order-by-two-columns/#comment-573</guid>
		<description>hanks a lot boss.</description>
		<content:encoded><![CDATA[<p>hanks a lot boss.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jsherk</title>
		<link>http://newsourcemedia.com/blog/php-mysql-order-by-two-columns/comment-page-1/#comment-569</link>
		<dc:creator>jsherk</dc:creator>
		<pubDate>Sat, 15 Jan 2011 17:14:11 +0000</pubDate>
		<guid isPermaLink="false">http://newsourcemedia.com/blog/1969/12/31/php-mysql-order-by-two-columns/#comment-569</guid>
		<description>If you need to combine two columns first and then sort based on the combination, you can do this:

I have two columns `lastname` and `organization`. If one is filled then the other one is always empty. A normal SELECT * FROM table ORDER BY organization,lastname would list all the organizations first and then the lastnames second, but I wanted to intermix them, so I did this:

SELECT * FROM table ORDER BY CONCAT(organization,lastname)

This will combine the two columns for the ORDER BY without actually creating a new column, so that lastname SMITH would appear in between organization RESQ and organization TIMET.</description>
		<content:encoded><![CDATA[<p>If you need to combine two columns first and then sort based on the combination, you can do this:</p>
<p>I have two columns `lastname` and `organization`. If one is filled then the other one is always empty. A normal SELECT * FROM table ORDER BY organization,lastname would list all the organizations first and then the lastnames second, but I wanted to intermix them, so I did this:</p>
<p>SELECT * FROM table ORDER BY CONCAT(organization,lastname)</p>
<p>This will combine the two columns for the ORDER BY without actually creating a new column, so that lastname SMITH would appear in between organization RESQ and organization TIMET.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Web Dizajn</title>
		<link>http://newsourcemedia.com/blog/php-mysql-order-by-two-columns/comment-page-1/#comment-557</link>
		<dc:creator>Web Dizajn</dc:creator>
		<pubDate>Wed, 29 Dec 2010 16:29:18 +0000</pubDate>
		<guid isPermaLink="false">http://newsourcemedia.com/blog/1969/12/31/php-mysql-order-by-two-columns/#comment-557</guid>
		<description>if(!isset($_GET[&#039;sort&#039;])==&#039;ASC&#039;){
$sort=&#039;DESC&#039;;
$sort_link=&#039;ASC&#039;;
$sort_link2=&#039;ASC&#039;;
}else{
$sort=&#039;DESC&#039;;//will be the defualt
$sort_link=&#039;ASC&#039;;
$sort_link2=&#039;ASC&#039;;</description>
		<content:encoded><![CDATA[<p>if(!isset($_GET['sort'])==&#8217;ASC&#8217;){<br />
$sort=&#8217;DESC&#8217;;<br />
$sort_link=&#8217;ASC&#8217;;<br />
$sort_link2=&#8217;ASC&#8217;;<br />
}else{<br />
$sort=&#8217;DESC&#8217;;//will be the defualt<br />
$sort_link=&#8217;ASC&#8217;;<br />
$sort_link2=&#8217;ASC&#8217;;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Complete osCommerce</title>
		<link>http://newsourcemedia.com/blog/php-mysql-order-by-two-columns/comment-page-1/#comment-523</link>
		<dc:creator>Complete osCommerce</dc:creator>
		<pubDate>Mon, 11 Oct 2010 09:01:54 +0000</pubDate>
		<guid isPermaLink="false">http://newsourcemedia.com/blog/1969/12/31/php-mysql-order-by-two-columns/#comment-523</guid>
		<description>yes You are right.

if some values are same in column_1 then second sort will be applied between those values.

Thanks</description>
		<content:encoded><![CDATA[<p>yes You are right.</p>
<p>if some values are same in column_1 then second sort will be applied between those values.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dudeson</title>
		<link>http://newsourcemedia.com/blog/php-mysql-order-by-two-columns/comment-page-1/#comment-522</link>
		<dc:creator>Dudeson</dc:creator>
		<pubDate>Sun, 10 Oct 2010 19:04:20 +0000</pubDate>
		<guid isPermaLink="false">http://newsourcemedia.com/blog/1969/12/31/php-mysql-order-by-two-columns/#comment-522</guid>
		<description>Hi, is there a way to make mysql order by the first column (higher priority) followed by the second column (lower priority)? This is not the same as column_1, column_2  where it means only if column_1 is the same, column_2 will be checked? Can Group By be used in this regard? Thanks.</description>
		<content:encoded><![CDATA[<p>Hi, is there a way to make mysql order by the first column (higher priority) followed by the second column (lower priority)? This is not the same as column_1, column_2  where it means only if column_1 is the same, column_2 will be checked? Can Group By be used in this regard? Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rahul Dev Katarey</title>
		<link>http://newsourcemedia.com/blog/php-mysql-order-by-two-columns/comment-page-1/#comment-325</link>
		<dc:creator>Rahul Dev Katarey</dc:creator>
		<pubDate>Sat, 29 Aug 2009 20:12:06 +0000</pubDate>
		<guid isPermaLink="false">http://newsourcemedia.com/blog/1969/12/31/php-mysql-order-by-two-columns/#comment-325</guid>
		<description>actually I need first column descending and second column ascending, but its only working if i use first column ascending and second column descending.</description>
		<content:encoded><![CDATA[<p>actually I need first column descending and second column ascending, but its only working if i use first column ascending and second column descending.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rahul Dev Katarey</title>
		<link>http://newsourcemedia.com/blog/php-mysql-order-by-two-columns/comment-page-1/#comment-324</link>
		<dc:creator>Rahul Dev Katarey</dc:creator>
		<pubDate>Sat, 29 Aug 2009 20:06:42 +0000</pubDate>
		<guid isPermaLink="false">http://newsourcemedia.com/blog/1969/12/31/php-mysql-order-by-two-columns/#comment-324</guid>
		<description>hi, i need to use order by in other directions like : date desc and priority asc

i used this : select * from tablename where category = &#039;1&#039; order by date desc, priority asc limit 30

this is not working right

if use this :

select * from tablename where category = &#039;1&#039; order by priority, date desc limit 30

this is working but i want date desc first then priority asc, how to do this please help

rahul</description>
		<content:encoded><![CDATA[<p>hi, i need to use order by in other directions like : date desc and priority asc</p>
<p>i used this : select * from tablename where category = &#8217;1&#8242; order by date desc, priority asc limit 30</p>
<p>this is not working right</p>
<p>if use this :</p>
<p>select * from tablename where category = &#8217;1&#8242; order by priority, date desc limit 30</p>
<p>this is working but i want date desc first then priority asc, how to do this please help</p>
<p>rahul</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
