![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
SQL
风很大很大
这个作者很懒,什么都没留下…
展开
-
mysql left join 时取从表最新的一条数据
mysql left join时取从表最新的一条数据原创 2022-07-03 12:59:09 · 9683 阅读 · 5 评论 -
SQL查出数据表中最后10行数据(结果正序排列)
select * from (select * from 表 WHERE 查询条件 order by id desc limit 10) as a order by a.id思路将表中的数据以id倒序查出需要的行数(例如最新的10行),然后将结果保存为临时表,再根据临时表的id再将结果正序排列...原创 2021-10-10 17:47:19 · 7418 阅读 · 0 评论 -
SQL语句 在范围内的时间
select * from ticket_store where create_date between '2020-10-29 10:15:38' and '2021-10-30 10:15:38';格式select * from 表名 where 日期字段名 between '开始日期' and '结束日期';注意:日期要加单引号!!!原创 2021-05-06 10:37:59 · 5395 阅读 · 0 评论