当前位置:网站首页>数据的删除和修改操作(mysql)
数据的删除和修改操作(mysql)
2022-04-23 07:15:00 【variation8】
//删除更新时间为空并且创建时间在5天以前的数据
DELETE FROM eqmt_order WHERE eqmt_order.update_time IS NULL AND DATE(eqmt_order.create_time) <= DATE(DATE_SUB(NOW(),INTERVAL 5 DAY));
//删除时长小于0.2的所有数据
DELETE FROM eqmt_order WHERE eqmt_order.duration<0.2
//删除指定用户的测试数据
DELETE FROM eqmt_order WHERE eqmt_order.uid=71 OR eqmt_order.uid=4 OR eqmt_order.uid=3 OR eqmt_order.uid=2 OR eqmt_order.uid=1
//更新订单使用时长并保留2位小数
UPDATE eqmt_order SET duration = ROUND(TIMESTAMPDIFF(MINUTE,eqmt_order.create_time,eqmt_order.update_time)/60,2)
//关联更新预约表
UPDATE eqmt_equipment,eqmt_reserve SET is_hot=1 WHERE eqmt_equipment.id=eqmt_reserve.equipment_id AND eqmt_reserve.`status`=1
//更新实际订单使用时长并保留2位小数
UPDATE eqmt_order SET duration = ROUND(TIMESTAMPDIFF(MINUTE,eqmt_order.create_time,eqmt_order.reset_time)/60,2)where eqmt_order.reset_time IS NULL
版权声明
本文为[variation8]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_31151123/article/details/123440309
边栏推荐
猜你喜欢
随机推荐
Comparison of indoor positioning methods of several intelligent robots
Listed on the Shenzhen Stock Exchange: the market value is 5.2 billion yuan. Lu is the East and his daughter is American
[programming practice / embedded competition] learning record of embedded competition (II): picture streaming based on TCP
LeetCode15. 三数之和
Find the largest of 3 strings (no more than 20 characters per string).
Solidity IDE Remix中文版使用手册
C language learning record -- use and analysis of string function (2)
网赚APP资源下载类网站源码
LeetCode15. Sum of three
Go语学习笔记 - 结构体 | 从零开始Go语言
Weekly leetcode - 06 array topics 7 ~ 739 ~ 50 ~ offer 62 ~ 26 ~ 189 ~ 9
How to import Excel data in SQL server, 2019 Edition
clang 如何产生汇编文件
Anti shake and throttling
PHP high precision computing
thinkphp6+jwt 实现登录验证
vivo,硬件安全的爱与雷霆
Face to face summary 2
2022.4.11-4.17 AI industry weekly (issue 93): the dilemma of AI industry
单点登录 SSO