I have seen several other examples of this for SQL, but I am looking especially for MySQL.
This is the code that I have (which works, but I find it extremely inefficient). I use an arbitrary date "2011-05-15", which should and should be returned "2011-06-30".
DATE_SUB( DATE_ADD( CONCAT( YEAR( CURDATE() ), '-01-01' ), INTERVAL QUARTER('2011-05-15') QUARTER ), INTERVAL 1 DAY )
What is the best way to do this?
source share