skip to main
|
skip to sidebar
草原學習誌
筆記工作上的各種心得,以期獲得的知識與經驗,能有效的分門別類,當有需要時,腦袋瓜子,不再翻箱倒櫃,尋找失落的連結!
2009年6月30日 星期二
select as table 運用
set nocount on
declare @ntime datetime
declare @stime varchar(19)
declare @etime varchar(19)
set @ntime = dateadd(d,-1,getdate())
set @stime = convert(varchar(10),@ntime,120) + ' 00:00:00'
set @etime = convert(varchar(10),@ntime,120) + ' 23:59:59'
-- *************************************************************
select a.custid, count(a.custid) as cnt
--into #custid_cnt_tmp
from
(select b.custid, b.cphone, b.mphone, b.ophone
from car_mem_cnt_tab a inner join car_cust_tab b
on a.custid = b.custid
where a.cnt_grp = 0) as a
inner join
(select a.custid, isnull(a.callerid,'') as callerid, a.workid
from car_workid_tab a
where a.createtime between @stime and @etime
and dbo.fn_wstate(a.cepresult, a.agtresult,'0') = 1
and left(a.callerid,2) = '09' -- 一定要手機來電
) as b
on a.custid = b.custid
where b.callerid in (a.cphone, a.mphone, a.ophone)
group by a.custid
-- STEP 2
update car_mem_cnt_tab
set cnt = isnull(a.cnt,0) + b.cnt,
utime = getdate()
from car_mem_cnt_tab a inner join #custid_cnt_tmp b
on a.custid = b.custid
where a.cnt_grp = 0
-- STEP 3
drop table #custid_cnt_tmp
沒有留言:
張貼留言
較新的文章
較舊的文章
首頁
訂閱:
張貼留言 (Atom)
標籤
T-SQL
程式開發
學習筆記
資料庫系統
系統維運
作業系統
網路管理
網路設備
VB6
D-LINK
Linux
辦公軟體
防火牆
關鍵名詞
OUTLOOK
工具軟體
DNS
WIN2k
iptables
排程管理
網誌存檔
►
2011
(2)
►
11月
(1)
►
8月
(1)
►
2010
(22)
►
12月
(2)
►
11月
(4)
►
7月
(4)
►
6月
(2)
►
5月
(2)
►
4月
(3)
►
2月
(2)
►
1月
(3)
▼
2009
(72)
►
12月
(5)
►
11月
(1)
►
10月
(4)
►
9月
(10)
►
8月
(6)
►
7月
(22)
▼
6月
(22)
select as table 運用
如何在Google Blogger中使用 SyntaxHighlighter
Linux 以時間排序檢視檔案
開放root直接以 telnet 連接上主機
fedora設定預設不進入x windows
SQL 2000 如何像2005一樣可以"暫停" trigger 機制
註冊 windows dll regsvr32.exe
有關ActiveX DLL 版本相容問題
有關Base64 Encode & Decode Lib
MD5的應用
Public Key vs Session Key
Equal-cost multi-path (ECMP)
查看Cisco Router CPU 運作狀況
Hinet ADSL MRTG 報表呈現解讀
DOS中的GREP
執行批次檔時,依日期產生LOG檔
win2k 如何支援>137GB的硬碟
網路流量監控 NetFlow
Search Engine Optimization(SEO)
@@ROWCOUNT
T-SQL % 取餘數,動態備份至不同磁碟
資料庫備份命令
►
4月
(2)
追蹤者
沒有留言:
張貼留言