hi
Please help me to resolve the query. i need to get the cells which are having negative figures. Here am selecting the negative figures for the month of january so if i give one more condition for february that "AND (dbo.GLAFS.OPENBAL) + (dbo.GLAFS.NETPERD1) +(dbo.GLAFS.NETPERD1) < 0 " it will delete my first raw of january. That is account id 3506. i have to do this till the month december. How can i do this till december without lossing any rows.
- SELECT ACCTID,FSCSYR,AUDTORG,SUM(OPENBAL) + SUM(NETPERD1) as JAN, SUM(OPENBAL) + SUM(NETPERD1)+ SUM(NETPERD2) as FEB FROM [BIDAT].[dbo].[GLAFS] where (SUBSTRING(dbo.GLAFS.ACCTID, 1, 4) BETWEEN '3251' AND '3999') and FSCSYR= 2016 and CURNTYPE = 'F' and FSCSDSG = 'A'and AUDTORG = 'SARRID' AND (dbo.GLAFS.OPENBAL) + (dbo.GLAFS.NETPERD1) < 0
- group by FSCSYR,AUDTORG ,ACCTID
ACCTID | FSCSYR | AUDTORG | JAN | FEB |
3506 | 2016 | SARRID | -1800000.000 | 0.000 |
3509 | 2016 | SARRID | -3568466.235 | -45489664 |
3510 | 2016 | SARRID | -465846 | -784961 |
3520 | 2016 | SARRID | -545796.265 | -5478978.312 |