Re: Sorting Output
| From: | 1LT John W. Holmes | Date: | Tue, 30 Jul 2002 15:53:38 +0000 |
| Subject: | Re: Sorting Output | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-110355@lists.php.net to get a copy of this message | ||
How are you displaying it? Show us some code...
---John Holmes...
----- Original Message -----
From: "Brian V Bonini" <b-bonini@cox.net>
To: "PHP Lists" <php-general@lists.php.net>
Sent: Tuesday, July 30, 2002 11:52 AM
Subject: [PHP] Sorting Output
> 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
>