我需要的帮助很少。我在mysql中有三个表。
- 产品
- 客户
- 售价
通常我的经典 asp 文件中有查询,它位于底部。
set rs1=db.execute("Select id from customers order by id desc")
DO WHILE NOT rs1.EOF
set rs2=db.execute("Select id from products where order by id desc")
DO WHILE NOT rs2.EOF
set rs3=db.execute("Select id from sellingprices where product_id="&rs2("id")&" and customer_id="&rs1("id")&" and status=1")
if rs3.eof then
db.Execute("INSERT INTO selling prices (price,product_id,status,customer_id) VALUES ('0','"&rs2("id")&"','1','"&rs1("id")&"');")
end if
rs3.close
Set rs3= Nothing
rs2.MoveNext
LOOP
rs2.close
Set rs2= Nothing
rs1.MoveNext
LOOP
rs1.close
Set rs1= Nothing
我的问题是如何使用 Mysql 创建存储过程?
最佳答案
您的查询有误
Select id from products where order by id desc
会给出错误,在where
之后你应该有一些东西可以比较,但你没有。
解决方案是删除 where
(假设其余代码正确)。
Select id from products order by id desc
关于mysql - 创建Mysql过程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52655798/