MySql: Date_add returns BLOB
Frage
i have the next query:
select avHours, date_add('2010-01-20', Interval 2 DAY) from tbl_available order by avHours;
but it returns a blob field and not a date field. when i see the value in the blob field, it's the right date.
how can i fix this?
Thanks in advance!
Lösung
MySQL functions sometimes converts to BLOB. You can fix it if you will cast 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)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow