Hi,
The two selects in this script:
drop table if exists foo;
create table foo (id int not null);
insert into foo (id) values (0), (1);
drop table if exists joiner;
create table joiner (joinerid int not null);
insert into joiner (joinerid) values (0), (1);
# This select produces the expected results.
select if(id > 10, 0 , 1.23) as zero,
if(id > 10, 0.0, 1.23) as zeropointzero
from foo
order by 1;
# This select does not.
select if(id > 10, 0 , 1.23) as zero,
if(id > 10, 0.0, 1.23) as zeropointzero
from foo, joiner
where id = joinerid
order by 1;
should produce identical results. Instead what we get is
zero zeropointzero
1.23 1.23
1.23 1.23
zero zeropointzero
1 1.2
1 1.2
The only difference between the two queries is that the second one
joins with the table 'joiner', while the first one joins with no
table. The join doesn't change the row set, and the joined field
isn't otherwise used.
The selects should produce the same values; if it can be fixed either
way, I prefer the behavior of the first select (non-truncation).
Thanks for looking at this, and for MySQL generally!
--
Pete Harlan
[EMAIL PROTECTED]
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php