I have a db with the following fields:

id | month | company | title | name | role | show_company | show_title |
show_month

sql query is: "select * FROM db ORDER BY month DESC";

Output gets formatted like:

month
 - company
 - title
    name   role
    name   role
 - title
    name   role
 - company
 - title
    name   role
    name   role
    name   role


The occurrence of the number of fields within each heading is not static.

The oldest data sits at the "beginning" of the db so the order by month desc
sorts the output from newest to oldest. Fine so far.

Now, as new data gets added to the db sometimes some of it refers to past
months. So although the order by month clause will move the new data to the
correct month it will not move it into the correct heading (company) and
sub_heading (title). I've tried using group by and using multiple fields in
the order by but can not get the results I'm looking for, any suggestions?

-Brian


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

Reply via email to