|
|
|
|
|
|||||
|
|||||
| 樓主 helloeveryone
發送站內信 |
有一table欄位有
pk id name update_time 1 1 aa 2010/3/1 2 1 bb 2010/3/2 3 2 cc 2010/3/3 4 2 dd 2010/3/4 我要找出 pk id name updat_time 1 1 aa 2010/3/1 3 2 cc 2010/3/3 我用select distinct(id) from table order by update_time 這樣不行 但我又不能用 select distinct(id),update_time from table order by update_time 這樣找出來的又等於沒篩選 請問有什麼辦法
本篇文章發表於2010-03-12 16:58
|
||||
| 什麼是iT Power資訊報 | 2010年藍色小舖認證專家風雲榜完全名單 |
| 1樓 |
方式如下:
1 aa 2010/3/1 2 cc 2010/3/3
本篇文章回覆於2010-03-12 21:47
--未登入的會員無法查看對方簽名檔--
|
| 2樓
作者回應
helloeveryone |
當我的更新時間如果有一模一樣的時間
取出來的id直就會重複 這樣就不對了
本篇文章回覆於2010-03-14 18:04
--未登入的會員無法查看對方簽名檔--
|
| 3樓 |
你要說清楚你想要的結果是如何...... 我只是依你想要的結果下條件的
多幾筆資料 想要的結果要清楚點喔.....
本篇文章回覆於2010-03-15 01:07
--未登入的會員無法查看對方簽名檔--
|
| 4樓 |
萊得熊的答案完全正確啊,join小調成 right join就可以啦
本篇文章回覆於2010-03-25 00:30
--未登入的會員無法查看對方簽名檔--
|
| 5樓
最有價值解答
johnson |
select * from
(select id,min(update_time) as update_time from #t1 group by id) as a left join #t1 as b on a.id=b.id and a.update_time=b.update_time
本篇文章回覆於2010-05-07 22:11
--未登入的會員無法查看對方簽名檔--
|
| 回覆 |
| 如要回應,請先登入. |
|
![]() |
|
|