• Jeff Moden - Monday, December 18, 2017 2:30 PM

    raghuldrag - Sunday, December 17, 2017 10:47 PM

    Hi Friends,

    i have a table  like  below i want to display financial year count

    Create table test
    (M1 vacrhar(20),
      M2 char(100)
    )

    insert  into test  values ('2001-2002','APR')
    insert  into test  values ('2001-2002','JUN')
    insert  into test  values ('2002-2003','NOV')
    insert  into test  values ('2003-2004','APR')
    insert  into test  values ('2001-2002','JUN')
    insert  into test  values ('2003-2004','DEC')

    if  we  gave the input from  m1 ='2001-2002'  and m2="APR'
     to m1='2003-2004' and m2='APR'

    i have to display no of financial year count
    (Apr-1999 to mar-2000) as one financial year

    kindly give me your suggestion

    Considering that neither your table nor your query makes any mention of either the year 1999 or 2000, please explain the logic you're using to convert the inputs to the desired output.

    Hi Jeff,
    My table contains from 2000-2001 financial year data like above  it is a typo error "(Apr-1999 to mar-2000)" I just want to calculate financial year count based on my input M1 between '2001-2002'  and '2003-2004' and M2  between 'Apr' and 'Jan'

    my financial year calculated from Apr to mar = 1 year
    so my desired output is

    AccYear        Financial Year count

    2001-2002           1
    2002-2003            2
    2003-2004            3