RE: Sorting table columns dynamically on normalized MySQL tables

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

 



[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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux