Dates with different Financial Year and quarters

April to March as financial Year
DATEqt_year
2015-March-042014-Q4
2015-March-092014-Q4
2015-April-112015-Q1
2015-April-242015-Q1
2015-September-102015-Q2
2015-September-142015-Q2
2015-October-092015-Q3
2015-October-162015-Q3
2016-February-112015-Q4
2016-February-182015-Q4
2016-June-092016-Q1
2016-June-242016-Q1
2016-July-142016-Q2
2016-July-272016-Q2
2016-October-132016-Q3
2016-October-212016-Q3
2017-January-032016-Q4
2017-January-122016-Q4
2017-May-102017-Q1
2017-May-192017-Q1
2017-August-172017-Q2
2017-August-292017-Q2
2017-December-072017-Q3
2017-December-222017-Q3
2018-March-022017-Q4
2018-March-122017-Q4
SELECT DATE_FORMAT( payment_dt,  '%Y-%M-%d' ) AS DATE,
CASE WHEN quarter(payment_dt)=1 
THEN CONCAT(YEAR(payment_dt)-1, '-Q',QUARTER(payment_dt)+3)
ELSE concat(YEAR(payment_dt),'-Q',QUARTER(payment_dt)-1) 
END AS qt_year 
FROM `plus2_bills`
October to September Financial Year
DATEqt_year
2015-March-042014-Q2
2015-March-092014-Q2
2015-April-112014-Q3
2015-April-242014-Q3
2015-September-102014-Q4
2015-September-142014-Q4
2015-October-092015-Q1
2015-October-162015-Q1
2016-February-112015-Q2
2016-February-182015-Q2
2016-June-092015-Q3
2016-June-242015-Q3
2016-July-142015-Q4
2016-July-272015-Q4
2016-October-132016-Q1
2016-October-212016-Q1
2017-January-032016-Q2
2017-January-122016-Q2
2017-May-102016-Q3
2017-May-192016-Q3
2017-August-172016-Q4
2017-August-292016-Q4
2017-December-072017-Q1
2017-December-222017-Q1
2018-March-022017-Q2
2018-March-122017-Q2
SELECT DATE_FORMAT( payment_dt,  '%Y-%M-%d' ) AS DATE, 
CASE WHEN QUARTER( payment_dt ) !=4
THEN CONCAT( YEAR( payment_dt ) -1,  '-Q', QUARTER( payment_dt ) +1 ) 
ELSE CONCAT( YEAR( payment_dt ) ,  '-Q', QUARTER( payment_dt )-3 ) 
END AS qt_year
FROM  `plus2_bills` 
We can change the display format of the Financial Year
April to March as financial Year
DATEqt_year
2015-March-042014-15 - Q4
2015-March-092014-15 - Q4
2015-April-112015-16 - Q1
2015-April-242015-16 - Q1
2015-September-102015-16 - Q2
2015-September-142015-16 - Q2
2015-October-092015-16 - Q3
2015-October-162015-16 - Q3
2016-February-112015-16 - Q4
2016-February-182015-16 - Q4
2016-June-092016-17 - Q1
2016-June-242016-17 - Q1
2016-July-142016-17 - Q2
2016-July-272016-17 - Q2
2016-October-132016-17 - Q3
2016-October-212016-17 - Q3
2017-January-032016-17 - Q4
2017-January-122016-17 - Q4
2017-May-102017-18 - Q1
2017-May-192017-18 - Q1
2017-August-172017-18 - Q2
2017-August-292017-18 - Q2
2017-December-072017-18 - Q3
2017-December-222017-18 - Q3
2018-March-022017-18 - Q4
2018-March-122017-18 - Q4
SELECT DATE_FORMAT( payment_dt,  '%Y-%M-%d' ) AS DATE,
CASE WHEN quarter(payment_dt)=1 
THEN CONCAT(YEAR(payment_dt)-1, '-',date_format(payment_dt,'%y'), ' - Q',QUARTER(payment_dt)+3)
ELSE concat(YEAR(payment_dt),'-',date_format(payment_dt,'%y') +1,' - Q',QUARTER(payment_dt)-1) END AS qt_year  FROM `plus2_bills`
October to September Financial Year
DATEqt_year
2015-March-042014-15 - Q2
2015-March-092014-15 - Q2
2015-April-112014-15 - Q3
2015-April-242014-15 - Q3
2015-September-102014-15 - Q4
2015-September-142014-15 - Q4
2015-October-092015-16 - Q1
2015-October-162015-16 - Q1
2016-February-112015-16 - Q2
2016-February-182015-16 - Q2
2016-June-092015-16 - Q3
2016-June-242015-16 - Q3
2016-July-142015-16 - Q4
2016-July-272015-16 - Q4
2016-October-132016-17 - Q1
2016-October-212016-17 - Q1
2017-January-032016-17 - Q2
2017-January-122016-17 - Q2
2017-May-102016-17 - Q3
2017-May-192016-17 - Q3
2017-August-172016-17 - Q4
2017-August-292016-17 - Q4
2017-December-072017-18 - Q1
2017-December-222017-18 - Q1
2018-March-022017-18 - Q2
2018-March-122017-18 - Q2
SELECT DATE_FORMAT( payment_dt,  '%Y-%M-%d' ) AS DATE,
CASE WHEN quarter(payment_dt)!=4 
THEN CONCAT(YEAR(payment_dt)-1, '-',date_format(payment_dt,'%y'), ' - Q',QUARTER(payment_dt)+1)
ELSE concat(YEAR(payment_dt),'-',date_format(payment_dt,'%y')+1,' - Q',QUARTER(payment_dt)-3) END AS qt_year  FROM `plus2_bills`


Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here .





    SQL Video Tutorials










    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer