Hi. IMHO your query should work. This looks like a bug to me. I can confirm this on 3.23.46, but have no more current version available for testing.
Bye, Benjamin. PS: Forwarded to [EMAIL PROTECTED] On Tue, Feb 26, 2002 at 05:08:59PM +0100, [EMAIL PROTECTED] wrote: > Hi > > I'm having a simple but annoying problem: > > i want to round() the value of a column, but the number of digits is > depending on the value of another column. i found out, that this doesn't work: > > create table testme > -> (number double (5,4),digits tinyint(3)); > Query OK, 0 rows affected (0.08 sec) > > mysql> explain testme; > +--------+-------------+------+-----+---------+-------+ > | Field | Type | Null | Key | Default | Extra | > +--------+-------------+------+-----+---------+-------+ > | number | double(6,4) | YES | | NULL | | > | digits | tinyint(3) | YES | | NULL | | > +--------+-------------+------+-----+---------+-------+ > 2 rows in set (0.08 sec) > > mysql> insert into testme values (100.4235,3),(85.4,1); > Query OK, 2 rows affected (0.08 sec) > Records: 2 Duplicates: 0 Warnings: 0 > > mysql> select * from testme; > +----------+--------+ > | number | digits | > +----------+--------+ > | 100.4235 | 3 | > | 85.4000 | 1 | > +----------+--------+ > 2 rows in set (0.08 sec) > > mysql> select round(number,digits) from testme; > +----------------------+ > | round(number,digits) | > +----------------------+ > | 100.4240 | > | 85.4000 | > +----------------------+ > 2 rows in set (0.08 sec) > > > is there any way i could do this with *one* query? > the only solution i see is to read the digits-column with a script and then > create a new query, but thats not possible in my case... > > thanks for any help > > Richard -- [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