_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › 讌螻譟一語伎襦

れ螻 螳 讌螻 譟一 貅磯. 豌襴覯 企 覈 6覦 襷 蟇.
select
    a.std_dt
,   a.hh
,   a.uu
,   b.up
from (
    select
        convert(date, InTime) std_dt
    ,   datepart(hh, InTime) hh
    ,   count(distinct no) uu
    from stg.svc.T_GameLogin
    where 1=1
    and InTime >= '20120905' 
    and InTime < convert(char(8), dateadd(dd,1, '20120912'), 112)
    group by
        convert(date, InTime)
    ,   datepart(hh, InTime)
) a
    inner join (
        select
            std_dt
        ,   datepart(hh, p_end_dt) hh
        ,   count(distinct acnt_key) up
        from ods.moma.play_end
        where 1=1
	        and Std_dt between '20120905' and '20120912'
        group by
            std_dt
        ,   datepart(hh, p_end_dt) 
    ) b
        on a.std_dt = b.std_dt
        and a.hh = b.hh

蠏碁磯, 觚螳 SQL Server螳 star join豌 bitmap 豌襷り . れ螻 螳 ろ螻. ろ企慨覃 語 讌 覈磯殊 蠏碁 ろ 豬.
1.png

蠏碁 れ螻 螳 join hint襯 譴 豌 襦 螳 譴螳蟆郁骸 讌 襷 merge join 豌襴蟆 . 3豐 豌襴.
select
    a.std_dt
,   a.hh
,   a.uu
,   b.up
from (
    select
        convert(date, InTime) std_dt
    ,   datepart(hh, InTime) hh
    ,   count(distinct no) uu
    from stg.svc.T_GameLogin
    where 1=1
    and InTime >= '20120905' 
    and InTime < convert(char(8), dateadd(dd,1, '20120912'), 112)
    group by
        convert(date, InTime)
    ,   datepart(hh, InTime)
) a
    inner merge join ( --蠍磯ゼ 覦蠖.
        select
            std_dt
        ,   datepart(hh, p_end_dt) hh
        ,   count(distinct acnt_key) up
        from ods.moma.play_end
        where 1=1
	        and Std_dt between '20120905' and '20120912'
        group by
            std_dt
        ,   datepart(hh, p_end_dt) 
    ) b
        on a.std_dt = b.std_dt
        and a.hh = b.hh

2.png
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:54

覯曙 伎螻 殊朱 覓願 蟆 蟆一 . 伎螻 朱蟾 ロ 讌 螳? (襦覯 )