Building an index table from a MySQL database with PHP

Fillarmiqa

New Member
Using MySQL and PHP; I'm trying to build an index that contains the averages from table_1 grouped by:type, name, hour, day, month, yearSo I need to know which combination's of values are in table_1 so I know what to put in my AVG() queries.What I want is to figure out all the different combination's that can be made when comparing the following rows in the table:\[code\]typenamehourdaymonthyear\[/code\]Here's an example of table_1:\[code\]ID|type|name|location|amount|year|month|day_num|day|hour|minute|second1|car|ben|1|1.00|2010|10|01|Friday|03|05|451|car|bob|1|3.00|2010|10|01|Friday|04|05|452|cow|bob|2|2.00|2009|07|12|Sunday|09|10|122|cow|ben|2|4.00|2009|07|12|Sunday|10|10|12\[/code\]So what I would end up with is:\[code\]type|name|year|month|day|hour car|ben|2010|10|01|Friday|03car|bob|2010|10|01|Friday|04cow|bob|2009|07|12|Sunday|09cow|ben|2009|07|12|Sunday|10\[/code\]How would I format a query to do that?
 
Back
Top