I have 3 tables that I wish to produce but I just cannot get my head around the logic for producing them. I'll try and explain the best I can.
I have one table and the contents are as follows
team | group
A | 1
B | 1
C | 1
D | 2
E | 2
F | 3
Basically what I want to do is have 3 tables based on "position" - so splitting those up with 1 in to 1 table, those with 2 in to 2 etc:
Table 1: Table 2: Table 3:
A D F
I know how I can do it roughly if I do seperate queries "where group='1'" but what I'm trying to do is look at a table to see how many groups I have (at this stage 3, but eventually there may be 4) and spit out that number of tables.
From there I want to print Table 1, then Table 2, then Table 3 (and if there's a 4th group, Table 4) with each of the teams listed below their respective Group
I assume that I must use some sort of loop, but I just cannot get my head around how to do that