Case nested inside another case

0

I have a lot of questions about CASE ANINHADO. I have to make an interest calculation that depends on some variables and I'm not able to set up this case, so I need your help to set it up.

E1_VENCREA GETDATE ZERO (0) because you still have a deadline to pay, otherwise you should continue to the 2nd QUESITO .

If the result of the 1st QUESTION is FALSE (that is, greater) should be checked if CONVERT (VARCHAR, CONVERT (DATETIME, E1_BAIXA), 103 is '01 / 01/1900 '.

If the result of the 2nd QUESTION is TRUE must be checked again if CONVERT (VARCHAR, CONVERT (DATETIME, E1_BAIXA) CONVERT (VARCHAR, CONVERT (DATETIME, E1_VENCREA), 103) is (>)

4º If the result of 3rd QUESTION is TRUE perform the following calculation SUM (((E1_PORCJUR / 100) * BALANCE) * DATEDIFF (DAY, E1_BUSINESS , GETDATE ())) 3rd QUESTION is FALSE perform this other calculation SUM (((E1_PORCJUR / 100) * BALANCE) * DATEDIFF (DAY, E1_VENCREA, GETDATE ())

Now here you go back to the end of the 2nd QUESTION if it is FALSE perform the following calculation SUM (((E1_PORCJUR / 100) * BALANCE) DATEDIFF (DAY, E1_VENCREA, GETDATE ())

6th Ready! now it's over, just name the column named INTEREST .

DATABASE IS SQL SERVER, STRUCTURE OF THE TABLES HERE DOWNLOAD DROPBOX TABLES

    
asked by anonymous 20.07.2016 / 21:57

0 answers