Mysql数据库中有order、orderitem和goods三张表,其中order与orderitem通过order的ID字段与orderitem的orderid字段关联;其中goods与orderitem通过goods的ID字段与orderitem的goodsid字段关联;
现在想做一个触发器,当一个订单被确认的时候,该订单中所有产品的剩余数量和出售数量做相应的改变,order表isvalid字段的值有其他值变为Y的时候更新goods表中store和salecount值,请问写入下的触发器为什么不能实现目的呢,另外在脚本中提示已经创建成功怎么通过SELECT * FROM information_schema.TRIGGERS;查询不到触发器呢?
PHP自动发卡平台个人版是采用php+mysql进行开发的自动发卡支付平台。服务器环境:PHP5.2以上版本mysql5.1 或以上版本安装说明:安装 http://你的域名/install.php 进行安装,后台路径http://你的域名/admin 后台账号:admin 后台密码:yc88.net需要修改用户名,可以进入数据库进行修改faka_users把admin改成其他支持改成中文
0
delimiter || drop trigger if exists updatestore|| create trigger updatestore after update on order for each row begin declare numorder int(11); set numorder = (select count(count) from orderitem where orderid = old.id); if new.isvalid ='Y' and old.isvalid !='Y' then update goods set store = store - @numorder, salecount = salecount + @numorder where id in (select goodsid from zsorderitem where orderid = old.id); end if; if new.isvalid !='Y' and old.isvalid ='Y' then update goods set store = store + @numorder, salecount = salecount - @numorder where id in (select goodsid from orderitem where orderid = old.id); end if; end||
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
C++高性能并发应用_C++如何开发性能关键应用
Java AI集成Deep Java Library_Java怎么集成AI模型部署
Golang后端API开发_Golang如何高效开发后端和API
Python异步并发改进_Python异步编程有哪些新改进
C++系统编程内存管理_C++系统编程怎么与Rust竞争内存安全
Java GraalVM原生镜像构建_Java怎么用GraalVM构建高效原生镜像
Python FastAPI异步API开发_Python怎么用FastAPI构建异步API
C++现代C++20/23/26特性_现代C++有哪些新标准特性如modules和coroutines
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号