Re: [請益] 要怎樣只讓資料庫中最後一筆資料顯示呢

看板PHP作者 (寶貝豬)時間17年前 (2009/02/04 10:23), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
MySQL: select * from ttt where 1=1 order by id desc limit 0,1; 上面感覺好像一行文, 補些描述: order by id desc //依id由大而小排序, 假設愈新的記錄其id愈大. limit 0,1 //對於查詢結果從排列序號為0的那筆開始取, 只取1筆. ※ 引述《tnsshnews (tnsshnews)》之銘言: : select * from table where constraint; : 找出來的資料有好幾筆 : 但是我只想要列出最後新增的那一筆 : 請問要怎麼弄呢 : 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 211.74.193.210
文章代碼(AID): #19YFm48A (PHP)
文章代碼(AID): #19YFm48A (PHP)