NULLIF truncating date values only when in a UNION ALL Statement in MySql -


i using statement similar union results 2 similar tables.

select sale_time, nullif(sale_time, '0000-00-00') 'nullif_sale_time' tblcompletedsales union select sale_time, nullif(sale_time, '0000-00-00') 'nullif_sale_time' tblopensales; 

sale_time timestamp field on both tables. instead of getting full date, in nullif_sale_time, truncated version. in other words, if sale_time '2015-08-12 09:33:46' nullif_sale_time '2015-0'. true records both tblcompletedsales , tblopensales.

example:

sale_time             nullif_sale_time 2015-06-15 10:44:44   2015-0 

if run either statement without union both work expected. has worked expected until today. happening on local machine remote server.

what cause this? there missing?

edit:

here fiddle shows same thing.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -