Re: [SQL ] select 資料表中每月月初及月底的資料( …

看板Database作者 (世界盡頭小酒館)時間17年前 (2008/11/22 04:19), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串5/5 (看更多)
提供另一種解法 假設資料表名稱#test,日期tDate,交易tTotal select tDate,tTotal from #test where tDate in ( select max(tDate) as tDate from ( select tDate, SUBSTRING(tDate,0,6) as tYYYMM from #test ) temp group by tYYYMM union select min(tDate) as tDate from ( select tDate, SUBSTRING(tDate,0,6) as tYYYMM from #test ) temp group by tYYYMM ) -- 現在是半夜四點...明天還要去加班 還在這邊回文... orz 我一定得了[解程式強迫症] -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.224.44.230 ※ 編輯: decadance 來自: 61.224.44.230 (11/22 04:41)
文章代碼(AID): #199nUyFT (Database)
討論串 (同標題文章)
文章代碼(AID): #199nUyFT (Database)