Hello,
I have table and I want to tabulate it by column "student", column "subject" and column "class" but column "Subject" and column "class" is not necessary to available in the data.
If it has column "subject" but not column "class" then it should tabulate by column "student" and column "subject".
If it has column "class" but not column "subject" then it should tabulate by column "student" and column "class".
If it has all the columns then it should tabulate by all three columns. Below are some examples.
Example 1: (It has both column "subject" and column "class")
Input:
| Class | Student | Marks | Subject |
| 1 | A | 10 | Math |
| 2 | A | 15 | Science |
| 3 | A | 12 | Science |
| 1 | B | 15 | Math |
| 2 | B | 12 | Science |
Output:
| Class | Student | Subject | max(Marks) |
| 1 | A | Math | 10 |
| 2 | A | Science | 15 |
| 3 | A | Science | 12 |
| 1 | B | Math | 15 |
| 2 | B | Science | 12 |
Example 2: (It has column "Class" but not column "subject")
Input:
| Class | Student | Marks |
| 1 | A | 10 |
| 2 | A | 15 |
| 3 | A | 12 |
| 1 | B | 15 |
| 2 | B | 12 |
Output:
| Class | Student | max(Marks) |
| 1 | A | 10 |
| 2 | A | 15 |
| 3 | A | 12 |
| 1 | B | 15 |
| 2 | B | 12 |
Example 3: (It has column "subject" but not column "class")
Input:
| Student | Marks | Subject |
| A | 10 | Math |
| A | 15 | Science |
| A | 12 | Science |
| B | 15 | Math |
| B | 12 | Science |
Output:
| Student | Subject | max(Marks) |
| A | Math | 10 |
| A | Science | 15 |
| B | Math | 15 |
| B | Science | 12 |
Please help me to resolve this problem.
Thanks