Re: max(DateField)+C <> max(DateField+C)
Posted by:
Tom Byars
Date: February 17, 2012 01:59PM
Here's another inconsistency for you Peter.
select * from (select date('2012-02-17') as DateFld) tbl1 left join (select date('2012-02-17') as DateFld, 'X' as StrFld) tbl2
using (DateFld)
where DateFld='2012-02-17 00:00:00';
This returns values ('2012-02-17', NULL) which implies MySQL assumes
tbl1.DateFld = '2012-02-17 00:00:00'
but
tbl2.DateFld <> '2012-02-17 00:00:00'.
Change the left join to an inner join as in
select * from (select date('2012-02-17') as DateFld) tbl1 inner join (select date('2012-02-17') as DateFld, 'X' as StrFld) tbl2
using (DateFld)
where DateFld='2012-02-17 00:00:00';
and it returns the values ('2012-02-17', 'X')
Now it seems MySQL recognises that
tbl1.DateFld = '2012-02-17 00:00:00'
and
tbl2.DateFld = '2012-02-17 00:00:00'
Subject
Written By
Posted
Re: max(DateField)+C <> max(DateField+C)
February 17, 2012 01:59PM
February 17, 2012 04:03PM
February 18, 2012 12:33AM
February 18, 2012 10:23AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.