How the problem is that the quarterly data accumulation, for example:
1 - March 1 quarter of
3 - June is the second quarter and so on...
I am now in the first quarter of value is 1-3 months
In the second quarter is June 1 -,
So how to query or, how to write in the program, hope to provide some
CodePudding user response:
QUARTER is the QUARTERThe SELECT DATEPART (QUARTER, GETDATE ())
CodePudding user response:
Similar to the above this way
Select *,
(select sum (results) from the TAB in_tab where in_tab. Ordertime. (get)=out_table ordertime (get) and in_tab (month and day) & lt; )='on April 1,' as' in the first quarter of '
The from the TAB out_tab
CodePudding user response:
Select *,(select sum (results) from the TAB in_tab where in_tab. Ordertime. (get)=out_table ordertime. (get) and in_tab ordertime (get in) & lt;=3 as' in the first quarter,
(select sum (results) from the TAB in_tab where in_tab. Ordertime. (get)=out_table ordertime. (get) and in_tab ordertime (get in) & lt;=6 as' accumulated in the second quarter '
The from the TAB out_tab
And so on
CodePudding user response:
The machine fixed, if the date is not fixed