Re: [PHP-DB] some data output formatting and grouping question...

2002-12-02 Thread Ignatius Reilly
Very simple procedurally (though not in SQL). Here's the pseudo-code: Execute: SELECT * FROM Y WHERE U = 'me' ORDER BY Y, X $flag = "last_y" ; // flag indicating whether or not your mysql_fetch_array() brings a new value of Y Loop your query result { if Y <> $flag['last_y'] { // thi

RE: [PHP-DB] some data output formatting and grouping question...

2002-12-02 Thread Snijders, Mark
I think you should first make a new datamodel, cause if I see this, it isn't right (just my 2 cents) :-) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DB] some data output formatting and grouping question...

2002-12-02 Thread David Smith
I don't see an easy way to do this in one SQL statement. But, the following PHP does the trick for me (assuming MySQL): // get the list of Y values $r = mysql_query( "SELECT * FROM table GROUP BY Y" ); while( $y_val = mysql_fetch_array( $r ) ) $y_vals[] = $y_val['Y']; // For each Y, fetch