You are here: Re: sorting a 3d array? « PHP Programming Language « IT news, forums, messages
Re: sorting a 3d array?

Posted by Jerry Stuckle on 12/02/07 19:33

Oliver Grätz wrote:
> Ciaran schrieb:
>> Cool solution there Chuck - best one so far by my reckoning! My select
>> statement is too complicated for me to sort results by date as Oliver
>> suggested - It's selecting various fields across multiple tables.
>
> That doesn't matter. If your query is "too complicated", you can always
> work with subqueries:
>
> SELECT wanted_field_1,wanted_field_2
> FROM (SELECT with your complicated query)
> AS subtable
> ORDER BY field_you_want_to have_the_max_value DESC
> LIMIT 1
>

Subqueries are almost never correct. Joins are much better.

> You are learning at the wrong end! If you say "my select statement is
> too complicated" you are saying "I should learn to understand my query"
> and not "It's bloated already, so let me find an even more bloated way
> to search through my results".
>
> Rule of thumb: If you have to sort/rearrange/manipulate your database
> query result afterwards, then your query was wrong in the first place.
>
> MySQL in version 5 has matured on the language level. You can even store
> your complicated query as a VIEW and then select the maximum from that
> view instead.
>
> => Invest one or two hours in reading some docs on http://dev.mysql.com
>
> OLLi
>


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

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

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