I have a table that has the max months column like the one below:
Category MaxMonths Title
X 3 Beginner-1
X 6 Intermediate-1
X 12 Avance-1
X 999 Master-1
Y 3 Beginner-2
Y 6 Intermediate-2
Y 12 Avance-2
Y 999 Master-2
I also have another table with a number of months column like the one below:
User #months Category
A 1 X
B 5 X
C 6 y
D 12 y
E 15 X
How can I write a case statement that shows based on the #months in the second table, what the user's title is?
For example, it needs to show user A's title is Beginner-1. I am able to join the tables using the category column but have a hard time matching the #months with maxMonths