Subject calculate difficulty level
Author Alejandro Garcia
Good afternoon,

I'm trying to calculate the difficulty level of some exercises, each exercise is identified by a numeric id and the difficulty level is defined by its parameters, each exercise has a different number of parameters.

To calculate the difficulty level for each exercise we identify all the possible values that each parameter can take, those values are given to us in a specific (and correct) order in a table, and we assign a numeric value starting from 1 to each one of it, for example if the values of parameter p are p1,p2 and p3 we have to assign a number from 1 to each of them:

Once assigned this values to each parameter, the difficulty level of the exercise is the sum of the values of every parameter.

Given an execution of the i exercise in a table:
Id    Parameters    Values
i        p                    p2
i        q                    q3
i        r                    r1
the three lines above should be replaced by one line
Id    Difficultylevel
i          2+3+1

I'm trying with a stored procedure, but can't manage..

Thanks a lot.

[Non-text portions of this message have been removed]