![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
sql
sql相关知识总结
JB091
搬砖码农
展开
-
批量处理新增数据方案
用户实体转载 2024-04-17 11:33:59 · 40 阅读 · 1 评论 -
mysql 用户阅读次数或是点击量,浏览量加1的操作
update xxxxx_xxx set count = count+1 where product_id = 1 就可以了,千万别查询出来原业务次数,然后作为参数传入,在进行+1。并发的时候对应的次数就不对了,会导致次数丢失。原创 2023-12-13 11:09:06 · 554 阅读 · 1 评论 -
mysql 按特定城市优先排序,然后按省份的中文字母排序,然后按城市的中文字母排序 示例。
when a.city ='东莞市' then 17。when a.city ='苏州市' then 10。when a.city ='西安市' then 11。when a.city ='长沙市' then 12。when a.city ='沈阳市' then 13。when a.city ='青岛市' then 14。when a.city ='郑州市' then 15。when a.city ='大连市' then 16。when a.city ='深圳市' then 0。原创 2023-12-13 10:57:08 · 461 阅读 · 1 评论 -
sql 有发布时间字段,排序字段,要求按发布日期先排序,然后按排序字段排序,然后按发布时间排序解决方案
1,用DATE函数将时间截取到日期。最后在order by的时候先 order by DATE(your_datetime_column) desc, sort desc, your_datetime_column desc。原创 2023-12-13 10:38:05 · 465 阅读 · 1 评论 -
mysql根据查询结果去排序示例
将查询结果作为条件,参与排序。原创 2023-12-13 10:18:58 · 418 阅读 · 1 评论