Home > database > Presto how according to the base date no points, a set of interval of a month
Presto how according to the base date no points, a set of interval of a month
Time:10-28
For help if the date is XXXX. Xx. Xx 'ten characters varchar format, the following figure, now hope to initial date for the starting point, every other month divided into a group with statistical GMV in each group, could you tell me how to group? If the substr (dt, 1, 7) points is natural, not the desired results, use dt + interval '1' if the month can only find out in the first group, don't know how to cycle
CodePudding user response:
Since not natural, that the so-called interval for a month, refers to how many days does, unity is 30 days, if the interval number is fixed, then in each record date date minus the minimum number of days, divided by a fixed the quotient of the number of days between to grouping,