Mailinglisten-Archive |
> Am 15.06.2007 um 09:32 schrieb Michael Borchers: > >> Bsp.: >> 6.45*12.04 = 77,658 >> >> Leider rundet MySQL direkt auf 77.66. > > Sicher? > > mysql> SELECT VERSION(); > +------------+ > | VERSION() | > +------------+ > | 5.0.37-log | > +------------+ > 1 row in set (0.00 sec) > > mysql> DESCRIBE test; > +-------+--------------+------+-----+---------+-------+ > | Field | Type | Null | Key | Default | Extra | > +-------+--------------+------+-----+---------+-------+ > | eins | decimal(4,2) | NO | | | | > | zwei | decimal(4,2) | NO | | | | > +-------+--------------+------+-----+---------+-------+ > 2 rows in set (0.00 sec) > > mysql> SELECT *, `eins` * `zwei` FROM test; > +------+-------+-----------------+ > | eins | zwei | `eins` * `zwei` | > +------+-------+-----------------+ > | 6.45 | 12.04 | 77.6580 | > +------+-------+-----------------+ > 1 row in set (0.00 sec) > > mysql> SELECT `eins` * 12.04 FROM test; > +----------------+ > | `eins` * 12.04 | > +----------------+ > | 77.6580 | > +----------------+ > 1 row in set (0.01 sec) > > mysql> SELECT `eins` * '12.04' FROM test; > +------------------+ > | `eins` * '12.04' | > +------------------+ > | 77.658 | > +------------------+ > 1 row in set (0.02 sec) > > Also, bei mir kommen die Sachen richtig raus. Sorry, MySQL 5.0.36, meine Testquery: SELECT menge,ep,menge*ep as ep_total,(1.0000*menge*ep) as ep_total2 FROM gaubenkalkulation_material WHERE gaubenkalkulation_id=11101 Ein paar Ergebnisse: menge ep ep_total ep_total2 738.76 0.01 7.39 7.3876 369.38 0.60 221.63 221.6280 2.00 3.95 7.90 7.9000 160.60 0.01 1.61 1.6060 8.03 0.55 4.42 4.4165 8.03 1.10 8.83 8.8330
php::bar PHP Wiki - Listenarchive