Mitch Miller wrote:
K.A.Bouton wrote:
> I need the output of my sql to be a multidimensional array as follows.
then Chris wrote:
> You won't be able to get an sql query to return in that format (I know
> what you're trying to do, I've used the same chart software).
This is my MSSQL Server solution, and yep, it outputs EXACTLY like
requested. I'm not sufficiently fluent with MySQL, so this may have
some "dialect" translation that needs done.
Also, this IS NOT a scalable solution at all. It assumes you know the
years you want the information for, and requires that you specify the
years in two specific areas of the query. Some SQL engines have a cross
tab function that will make this a little more automatic (MSSQL is one
such engine), but they are typically extensions to the SQL spec. and are
specific to each engine (i.e. the MSSQL implementation would not work
for MySQL).
I stand corrected :) mysql should support something like that but yeh
it's not a great solution (ie it's a horrible query) ;)
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php