问题描述
为了跟踪我的访客购买了多少水果,我使用了一个mySQL数据库
(2列:水果和数量)....所以我们可以制作这些以下
mySQL查询以某种方式工作?
(访客购买5个苹果):
替换为fruit_database set fruit =''apple '',数量=数量+
5;
(访客购买7个苹果):
替换为fruit_database set fruit = ''apple'',数量=数量+
7;
(访客买1葡萄):
替换为fruit_database set fruit =''grape'',数量=数量+
1
谢谢!
To keep track of how many fruits my visitors buy, I use a mySQL database
(2 columns: "fruit" and "quantity")....so can we make these following
mySQL queries work somehow?
(visitor buys 5 apples):
replace into fruit_database set fruit = ''apple'' , quantity = quantity +
5;
(visitor buys 7 apples):
replace into fruit_database set fruit = ''apple'' , quantity = quantity +
7;
(visitor buys 1 grape):
replace into fruit_database set fruit = ''grape'' , quantity = quantity +
1
Thanks!
推荐答案
你是基本的sql语法吗?
更新fruit_database设置数量=数量+ 5其中fruit ='''苹果''
你好吗?如何从php访问mysql?
Steve
are you after basic sql syntax?
update fruit_database set quantity = quantity + 5 where fruit = ''apple''
are you after how to access mysql from php?
http://www.php.net
Steve
你正在从错误的角度处理这个问题。您应该查询
客户销售记录并从中生成摘要信息。
INSERT INTO销售(客户,产品,数量)价值
(''
You are approching this from the wrong angle. You should be quering the
customer sales records and producing summary information from that.
INSERT INTO sales (customer, product , qty) VALUES
(''
这篇关于mysql更新/替换语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!