[eluser]vtatds[/eluser]
i've built crosstabs before in sql server. however, i'm having difficulty getting one set up in mysql.
i'm trying to get dates as columns and people and their results for those dates as rows. something like this
01/01/2008 03/17/2009 04/01/2010
Bob 5:00 Mins 4:45 Mins 4:00 Mins
Sally 8:00 Mins 7:38 Mins 6:37 Mins
Ted 3:00 Mins
Jane 5:00 Mins 4:26 Mins
I'm currently running two queries; one to get the dates for the columns and one to get the results for those dates. then looping through the arrays returned from the query for dates to make the column headers and then the results array, comparing dates in both arrays to determine if i print a result or space. the display isn't as tight as i'd like but i've made it work.
however, i can't seem to get pagination to work with this(two arrays of different lengths). i'm a little rusty with my logic these days. anyone have any thoughts on doing a proper crosstab this using mysql (dates and results come from a database so I can't hardcode IF in the query). all the examples I've seen with mysql hardcode the columns and they are doing SUM in the rows. i'm having a hard time getting past that and applying the logic to my data.