Hey yall,
And thanks first off to tomhath, vincent and Chris for simply trying 🙂. I can see it's simply no use doing this without explaining the exact problem. Ok - Try and bear with me on this one... Think of the application as 11 lists with entries in them, some of which dynamically change depending on the choices in the previous lists...
The first table is reponsible for displaying these lists in the application, and in turn also keeping in check which entries belong where and in what order.
The first table consists of 5 columns. The unique ID (Number), and ID for the order in which the entry is listed (Number), the actual displayed name of the entry (text), the list the entry belongs to (text), and finally the referrer ID (Number) - which helps determine which entry called this entry... The referrer ID would match a unique id.
The second table consists of a column for the unique ID for each entry, a column for each existing list (11 in total) and a few other uninteresting columns. This table is used for storing the entered results.
What I'm building now - is the statistic for the entered data - and the first thing I need to do, is to split up the search criteria using 3 of the lists in the application. One of which changes dynamically. In any case I need to do a search for certain fields and each time, the search must be done once with every possible combination of those 3 lists...
List 1 has 3 entries
List 2 has 3 entries and is also the referrer for List 3 which changes dynamically depending on the selection in List 2.
Once again I'll be showing this example based on the ID which decides in which order they are listed - NOT the unique Id.
1-1-1
1-2-1
1-2-2
1-2-3
1-2-4
1-2-5
1-3-1
2-1-1
2-2-1
2-2-2
2-2-3
2-2-4
2-2-5
2-3-1
3-1-1
3-2-1
3-2-2
3-2-3
3-2-4
3-2-5
3-3-1
That's the number of times I need to look for a number of maybe 50 fields in the 2nd table. And doing this in a simple search each time is a waste of CPU. That is why I'm wondering if it's possible to formulate a query to let MySQL circle through these criterias for the fields itself, and not need me to build 3 entwined loops for each query.
MySQL won't need to read from table 1 while searching for these criterias in table 2 - cause I can let PHP handle the var transfers...
Maybe this clears it up a little?
Gazoo... 😃