here is the whole picture. There is a table (table programparticipants) that stores all participants of all programs, there is another table (table programs) that stores all the programs. What I need to accomplish is the following:
- Acquire the programs where a user has attended more than one program (done)
- Acquire the other programs (from step 1) that a user attended based one one program
- Acquire the count of occurences that of two programs being attended by users.
Example table (programparticipants)
UserID Program
1 2
1 3
2 2
2 4
2 5
3 1
3 2
3 5
3 6
3 7
4 5
4 6
4 7
5 4
5 5
5 6
5 7
Example output
- prog 2 - ASSOCIATED PROGRAMS(3)
- prog 2 - OCCURENCES (1)
- prog 2 - ASSOCIATED PROGRAMS(4)
- prog 2 - OCCURENCES (1)
- prog 2 - ASSOCIATED PROGRAMS(6)
- prog 2 - OCCURENCES (1)
- prog 2 - ASSOCIATED PROGRAMS(7)
- prog 2 - OCCURENCES (1)
- prog 4 - ASSOCIATED PROGRAMS(2)
- prog 4 - OCCURENCES (1)
- prog 4 - ASSOCIATED PROGRAMS(5)
- prog 4 - OCCURENCES (2)
- prog 4 - ASSOCIATED PROGRAMS(6)
- prog 4 - OCCURENCES (1)
- prog 4 - ASSOCIATED PROGRAMS(7)
- prog 4 - OCCURENCES (1)
- prog 5 - ASSOCIATED PROGRAMS(4)
- prog 5 - OCCURENCES (2)
- prog 5 - ASSOCIATED PROGRAMS(6)
- prog 5 - OCCURENCES (3)
- prog 5 - ASSOCIATED PROGRAMS(7)
- prog 5 - OCCURENCES (3)
- prog 6 - ASSOCIATED PROGRAMS(2)
- prog 6 - OCCURENCES (1)
- prog 6 - ASSOCIATED PROGRAMS(5)
- prog 6 - OCCURENCES (3)
- prog 6 - ASSOCIATED PROGRAMS(7)
- prog 6 - OCCURENCES (3)
- prog 7 - ASSOCIATED PROGRAMS(2)
- prog 7 - OCCURENCES (1)
- prog 7 - ASSOCIATED PROGRAMS(4)
- prog 7 - OCCURENCES (1)
- prog 7 - ASSOCIATED PROGRAMS(5)
- prog 7 - OCCURENCES (3)
- prog 7 - ASSOCIATED PROGRAMS(6)
- prog 7 - OCCURENCES (3)
This will be going into a datagrid displaying something like:
prog 1 prog 2 prog 3 prog 4 prog 5 prog 6 prog 7
prog 1
prog 2 1 1 1 7
prog 3 1
prog 4 1 2 1 1
prog 5 2 3 3
prog 6 1 3 3
prog 7 1 1 3 3
If anymore explaination is needed please let me know.
I do have existing code if needed.