vendredi 21 avril 2017

how to implement this day diffrence logic using case or if else in SQL server

please tell me how to implement this logic in SQL server i am a newbie i am confused how to implemt this in SQl server usign case or if/else
1.) Rating period

@from                @to

    01/01/2016       31/12/2016

lease

1.1) start               end
   01/02/2016          31/12/2016
 then daydiff(lease start)-(lease end))

1.2) 01/01/2015           05/09/2016
then daydiff( 1st day(leas end)-(05/09/2016))

1.3) 01/01/2015             05/09/2018
then daydiff(rating @from)-(rating @to)

1.4)01/03/2016             01/09/2016
 then daydiff(lease start-lease end)

2 .Rating period

@from              @to
01/03/2016        31/12/2016

lease

2.1) start           end
    01/02/2016     31/12/2016
then daydiff(rating period @from-rating period @to))

2.2) 01/01/2015     05/09/2016
 then daydiff(@from-leas end)

2.3) 01/01/2015      05/09/2018
then daydiff(from-end)

2.4)01/04/2016             01/09/2016
  daydiff(lease start-leas end)

Aucun commentaire:

Enregistrer un commentaire