Re: sql output to a multidimensional array

From: Date: Thu, 07 Sep 2006 20:59:42 +0000
Subject: Re: sql output to a multidimensional array
References: 1 2 3  Groups: php.db 
Request: Send a blank email to php-db+get-42325@lists.php.net to get a copy of this message
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/

« previous php.db (#42325) next »