You are here: Re: [PHP] Sorting table columns dynamically on normalized MySQL tables « PHP « IT news, forums, messages
Re: [PHP] Sorting table columns dynamically on normalized MySQL tables

Posted by Kim Briggs on 04/20/05 03:44

Greetings,

If you are still looking for "tips" and want to get complicated/fancy,
I have seen columns used called sort_order more than a few times.
This should not be too hard to maintain for things like a few
buildings, etc., where the lookup table does not change much over
time. You would then have another option for your "oder by" clause.

cheers,
KB

On 4/19/05, Jay Blanchard <jay.blanchard@niicommunications.com> wrote:
> [snip]
> I can do that, but is there a better way? How do you all handle
> dynamic sorting of normalized DBs?
> [/snip]
>
> Normalization has no effect on sort order where any DB is concerned.
> Sort order is determined in the sort clause in the query. So if you want
> to sort by location and you are using MySQL your ORDER BY clause should
> be location....(regardless of joins)
>
> SELECT foo
> FROM bar
> ORDER BY location
>
> returns
>
> course instructor location
> Science Bill Elementary School
> Basket Weaving Dave High School
> Math Dave Middle School
> Biology Jessica Middle School
>
> The results with course as the sort qualifier
>
> course instructor location
> Basket Weaving Dave High School
> Biology Jessica Middle School
> Math Dave Middle School
> Science Bill Elementary School
>
> You have over-compicated a simple issue
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация