Last 13 months!
J_ORCLJun 15 2012 — edited Jun 15 2012Hi everyone,
I do need to mantain a table with the las 13 of a month, for example:
ID Month_ID MONTH_MAT
1 201206 201106
2 201206 201107
3 201206 201108
4 201206 201109
5 201206 201110
6 201206 201111
7 201206 201112
8 201206 201201
9 201206 201202
10 201206 201203
11 201206 201204
12 201206 201205
13 201206 201206
Kind of a year-to-date table but this one is 13 months one.
I have been trying to create the code from scratch but any help will be more tan appreciated
I have thought of using a Function, and found out this one that might be able to help me out, but have not gotten too much idea of how to!
Query: SELECT TRUNC(ADD_MONTHS(SYSDATE, -13),'MM') FROM dual;
Result: 01-MAY-11
I do really appreciate your help and guidance!
Best regards.
J_ORCL