MySql: Date_add returns BLOB

I have the following query: select avHours, date_add('2010-01-20', Interval 2 DAY) from tbl_available order by avHours;

but returns a blob field, not a date field. when I see the value in the blob field, this is the correct date.

how can i fix this?

Thanks in advance!

+6
source share
1 answer

MySQL functions are sometimes converted to BLOBs. You can fix this if you cast the result to a DATE type yourself, for example -

 SELECT DATE(DATE_ADD('2010-01-20', INTERVAL 2 DAY)) 

or

 SELECT CAST(('2010-01-20' + INTERVAL 2 DAY) AS DATE) 
+10
source

Source: https://habr.com/ru/post/908673/


All Articles