The opening qtr balance is the be the sum of all dr's and cr's [b]prior [/b]to a particular date. I want to see the qtr_opn_bal for [b]2014-07-01 00:00:00.000 and 2014-10-01 00:00:00.000 for each of the Ldgr_id's within both the @start_date and @end_date.[/b]What I am looking for when the user selects '01-JUL-2014' as the start date and '31-OCT-2014' the following should displayQTD_SD LDGR_ID QTR_# YR QTR_OPN_BAL2014-07-01 00:00:00.000 LDGR_ID1 3 2014 456.0002014-07-01 00:00:00.000 LDGR_ID3 3 2014 498.0002014-07-01 00:00:00.000 LDGR_ID4 3 2014 9856.0002014-10-01 00:00:00.000 LDGR_ID1 4 2014 700.0002014-10-01 00:00:00.000 LDGR_ID3 4 2014 40.0002014-10-01 00:00:00.000 LDGR_ID4 4 2014 89000.000Can anyone help me with what I need to do to achieve this? I have a funny feeling the order date syntax is an issue...ORDER_DATE <= DATEADD(QUARTER, DATEDIFF(QUARTER, 0, @START_DATE), 0) OR ORDER_DATE <= DATEADD(QUARTER, DATEDIFF(QUARTER, 0, @END_DATE), 0)
↧