mysql的sql筛选排重最大值并修改其属性

 

修改属性

mysql -h192.168.1.51 -uroot -e "use codex_game_s1051_h; update user_info set isActive=0 where 1=1"

mysql -h192.168.1.51 -uroot -e "use codex_game_s1051_h; update user_info set isActive=1 where userId in (select r.userId from role r join role s on r.userName=s.userName where r.lv>s.lv group by r.lv)"

mysql -h192.168.1.51 -uroot -e "use codex_game_s1051_h; update user_info set isActive=1 where userName not in (select * from (select userName from user_info where isActive=1) as temp)"

 

 

验证修改
mysql -h192.168.1.51 -uroot -e "use codex_game_s1051_h; select r.userId,r.userName, r.lv, r.vipLv,r.roleName from role r where r.userName='g324'"
mysql -h192.168.1.51 -uroot -e "use codex_game_s1051_h; select * from user_info where userName='g324'"

mysql -h192.168.1.51 -uroot -e "use codex_game_s1051_h; select r.userId,r.userName, r.lv, r.vipLv,r.roleName from role r where r.userName='d755d7f29a679a11c235cf8ff0b20b45'"
mysql -h192.168.1.51 -uroot -e "use codex_game_s1051_h; select * from user_info where userName='d755d7f29a679a11c235cf8ff0b20b45'"

mysql -h192.168.1.51 -uroot -e "use codex_game_s1051_h; select r.userId,r.userName, r.lv, r.vipLv,r.roleName from role r where r.userName='ae47ebbec25cd60f'"
mysql -h192.168.1.51 -uroot -e "use codex_game_s1051_h; select * from user_info where userName='ae47ebbec25cd60f'"

posted @   会飞的斧头  阅读(1020)  评论(0编辑  收藏  举报
编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示