Sql 为什么逗号会弄乱插入的内容
这是我的问题Sql 为什么逗号会弄乱插入的内容,sql,mysql,Sql,Mysql,这是我的问题 insert into invoices set Invoice_number = '823N9823', price = '11,768.00', code = 'ret_4_business', created_at = '2010-09-27'; 但我的db价格是11,不是11768 在mysql中如何处理金钱?该字段为十进制 CREATE TABLE `invoices` ( `id` int(11) NOT NULL AUTO
insert into invoices
set Invoice_number = '823N9823',
price = '11,768.00',
code = 'ret_4_business',
created_at = '2010-09-27';
但我的db价格是11,不是11768
在mysql中如何处理金钱?该字段为十进制
CREATE TABLE `invoices` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`Invoice_number` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`price` decimal(10,0) DEFAULT NULL,
`code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
任何非数字字符都将终止解析并仅保存部分数字。从查询中删除逗号字符。
DECIMAL(10.0)
也应该是INT
,因为除非指定的数字超过零,否则它不会捕获美分。像十进制(10.2)
。。。