Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get all months last days in mysql

Tags:

mysql

For example I have a table with fields:

id     date
1      2001-01-01
2      2001-01-05
.................
N      2011-12-31

How get i get all months last days from this table? example:

if i have dates like 2001-05-31 and 2001-06-01 i need only 2001-05-31 not both

like image 961
errx Avatar asked Nov 24 '25 09:11

errx


1 Answers

You can do SELECT LAST_DAY for example the below returns Oct. 31st. 2010

SELECT LAST_DAY('2010-10-10');
like image 185
sealz Avatar answered Nov 27 '25 00:11

sealz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!