id INT(8) UNSIGNED NOT NULL AUTO_INCREMENT, products_id(8) not null, price varchar(10) not null, quality int(7) not null, text varchar(255) not null, id | products_id | price | quality | text1 | 1 | 15.00 | 25 | 备注 2 | 1 | 15.60 | 30 | 备注 ... select * from table where products_id='1' order by id limit 1. 取出最近更新的,产品编号1的。 select * from table where products_id='1' 取出所有产品编号1的
为什么不可能把 价格、数量、备注 放在三个独立字段?
要存储在一个字段里 可以序列化或者处理成json存入,取出来的时候再处理成相应的数组
products_id(8) not null,
price varchar(10) not null,
quality int(7) not null,
text varchar(255) not null, id | products_id | price | quality | text1 | 1 | 15.00 | 25 | 备注
2 | 1 | 15.60 | 30 | 备注
...
select * from table where products_id='1' order by id limit 1. 取出最近更新的,产品编号1的。
select * from table where products_id='1' 取出所有产品编号1的
serialize()