Mysql change week number

-1

could you help me please, I have these records that have the week number.

semana
42
43
44
45
46
47
48
49
50
51
52
1
2
3
4
5
6
7
8
9
10

but I would like to change them like that;

42->1
43->2
44->3
...
...
...
52->11
1->12
2->13
3->14

How could I do it?

    
asked by skycomputer2 29.12.2017 в 00:07
source

1 answer

1

Do not you see a pattern there? Something like you're subtracting 41 from all values greater than 41 ... and you add 11 to all those under 41 .

This, I know well, I should put it as a comment (I still do not have enough "reputation" for it). But I would not want to "do your homework" either. I think I'll go to a mid-point and I'll describe the pseudo-code that I propose as a solution.

actualiza semana con (semana-11) si semana es mayor a 41;

and, subsequently

actualiza semana con (semana + 11) si semana es menor a 41;

Please, comment if you have found the solution. Greetings.

    
answered by 29.12.2017 / 00:59
source