查询MYSQl数据表中的最后一条记录


mysql:

select * from table order by id DESC limit 1

oracle:

select * from emp where id in (select max(id) from emp);

 

实例:

mysql> use weifeng;
Database changed


mysql> select * from tb_post order by id desc limit 10 \G;


*************************** 1. row ***************************
             id: 24897419
      bloggerId: 287172
        likeNum: 52
       postTime: 2016-03-24 16:01:07
spiderFetchTime: NULL
       postRank: NULL
         showId: NULL
     platformId: 1
 postPlatformId: 1_b1d88acb5e5a21ed70785c41f3d5fe25
   sourcePostId: NULL
       mediaUrl: https://weifeng-hangzhou.aliyuncs.com/data_infra/ins/5d846f9ff66cf46ebbe115f91892bb08.jpg
          width: 1080
         height: 809
       fileSize: 245829
     averageHue: 0x4f4838
      mediaType: 0
    textContent: Senior Camp 2016🌅
        postUrl: https://www.instagram.com/p/BDVAwpSksNi
       orderNum: 0
        postTag: NULL
       videoUrl: NULL
  favoriteCount: 0
         status: 1
   accessStatus: 8
     created_at: 2018-09-19 04:12:30
     updated_at: 2018-09-19 04:12:30
     deleted_at: NULL

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM