COALESCE两个日期是否返回二进制? [英] COALESCE two dates returns binary?

查看:86
本文介绍了COALESCE两个日期是否返回二进制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么COALESCE(date1,date2)返回Blob(二进制)?两列都是DATETIME类型.

Why does COALESCE(date1,date2) return Blob(binary)? Both columns are of type DATETIME.

这是完整的sql查询:

Here's the complete sql query:

SELECT COALESCE( last_modified, date_purchased )As LastModifiedOrPurchased
FROM Orders
ORDER BY COALESCE( last_modified, date_purchased )DESC
LIMIT 1;

我通常使用SQL Server作为rdbms,但是需要编写一个同步工具.现在,我正在尝试选择两个日期之一.如果last_modified为空,则应返回date_purchased.

I'm normally using SQL-Server as rdbms but need to write a synchronization tool. Now i'm trying to select one of two dates. If last_modified is null date_purchased should be returned.

但是,即使有多个记录的两个日期都不为空,查询也只返回Blob.如何获得正确的最后日期?

But even if there are multiple records where both dates are not null, the query returns just Blob. How to get the correct last date?

编辑:在 SQL-Fiddle 上strong> 不能用MySql 5.1.61(我在5.0.51上)重现.

Edit: on SQL-Fiddle it is not reproducable with MySql 5.1.61 (i'm on 5.0.51).

推荐答案

这可能是已修复的错误:

This is probably a bug that has been fixed: bug-35662

[2008年3月28日22:44]帕特里克·克鲁斯

[28 Mar 2008 22:44] Patrick Crews

说明:
COALESCE(date, date)在Windows的 5.0.51a上返回varbinary XP 32位(仅测试了这种口味)

Description:
COALESCE(date, date) returns varbinary on 5.0.51a for Windows XP 32bit (only tested this flavor)

COALESCE(date,date)在Mac OS上返回日期

COALESCE(date,date) returns date on Mac OS

...
...
...

...
...
...

[2008年3月31日17:41] Omer BarNir
该错误已在5.0.52中修复,在测试5.0.56-关闭时未观察到

[31 Mar 2008 17:41] Omer BarNir
The bug was fixed in 5.0.52 and was not observed when testing 5.0.56 - closing

这篇关于COALESCE两个日期是否返回二进制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆