I'm starting a new project and I'm about to take perhaps the most important design decision.
I'll be working with PHP to create dynamic queries on the fly. (I want to provide the users with someting similar to the dynamic tables in MS Excel).
I have like 25 tables with about 4-6 columns each, that I'll be joining depending on user selection (most operations will be calculating AVG, SUM, COUNT, etc depending on some filters of values that are probably 5 to 6 table joins away).
I'm thinking making all these JOINS and SELECTS on the fly as well as the GROUPS BY but it looks like it's going to be quite complicated, so I started thinking about using views to reduce the complexity of the code that dynamicaly builds the query.
I also thought avoiding GROUPS BY in the query and calculate aggregate funcitions using loops and an array in the code.
I would like to know which of these approaches would you recommend or if you have any sugestion or tip will be greatly appreciated.