Sort on Two Columns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm trying to sort a table on two columns but none of the options I've tried produces the right result (though the obvious works in mysql: order by caucuses.cbc, caucuses.state). I want to sort first by column caucuses.cbc (which distinguishes about 1/10 of the rows) and then by caucuses.state (which includes all rows). The CBC column designation ("B") should come first, with the rest of the CBC column blank. I'd actually like to sort by three columns (caucuses.cd is the third).

Among others, I've tried:

echo "<td><div align='center'><font size='3'><b>CBC <a href='108thfirst.php?sort_field=caucuses.cbc&sort_order=desc&sort_order=desc, sort_field=caucuses.state&sort_order=desc&sort_order=desc' target='_self'><font size='2'>Sort</a> </b></font></div></td>\n";

echo "<td><div align='center'><font size='3'><b>CBC <a href='108thfirst.php?sort_field=caucuses.cbc, caucuses.state&sort_order=asc' target='_self'><font size='2'>Sort</a> </b></font></div></td>\n";
(This orders state first, cbc ordered at bottom by state; reversing caucuses.cbc and caucuses.state gives state sort and cbc within state).


Thanks in advance.

Ken

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux