I have 2 tables and I am trying to output the most efficient table JOIN on a mySQL query.
Table 1: qa_framework_activities
id | activity
+--|-------------------
1 | text
2 | more text
3 | even more text
4 | more andmore text
5 | blah blah
6 | blah blah
and......
Table 2: qa_framework_indicators
id | pid | indicators | chrono
+---|-----+-------------------------------+--------
1 | 2 | text blah blayh | 1
2 | 2 | more text blah | 4
3 | 3 | even more text lipsum | 3
4 | 6 | more andmore text lipsum blah | 6
pid = parent id (the id in the first table)
So the presumed mySQL query would be:
SELECT
qa_framework_activities.id,
qa_framework_indicators.id
FROM
qa_framework_activities,
qa_framework_indicators
WHERE
qa_framework_activities.id = qa_framework_indicators.pid
The issue I am having is how do I most efficiently display the results (qa_framework_indicators.indicators grouped by qa_framework_activities.activity) sorted by Chrono value in the Chrono column to show in the below table -- any one of 6 columns?
I want to output the above data based on the chrono table 2 column (chrono value is 1 - 6)
So the end result would look like:
Chrono 1 | Chrono 2 | Chrono 3 | Chrono 4 | Chrono 5 | Chrono 6 |
+----------|-------------|-------------|-------------|-------------|-------------|
Activity | Activity | Activity | Activity | Activity | Activity |
indicator | indicator | indicator | indicator | indicator | indicator |
indicator | | | | | |