_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › 覓語1


覓語 #

一危郁 覈企.
seq	h
1	譴覿襯1
2	覿襯1
3	覿襯2
4	覿襯3
5	譴覿襯2
6	覿襯4
7	譴覿襯3
8	覿襯5

螳 蟆郁骸襯 至 矩.
seq	h
2	覿襯1
3	覿襯2
4	覿襯3
1	譴覿襯1
6	覿襯4
5	譴覿襯2
8	覿襯5
7	譴覿襯3
--讌覓 豢豌: http://www.sqler.com/bSQLQA/745455

覓語 覿 #

RDB 轟 譴 螳 覓伎. 讀, relationship . 襦 る relationship 一危郁 伎 . 襦 覲碁る 覿襯1, 覿襯2, 覿襯3 譴覿襯1螻殊 relationship 一危磯 譟伎 . 蠏碁磯磯 覿蟲螻 蟲褐 願碓讌襦 企慨蟆る 譴覿襯 覲 螳ロる 螳 れ螻 螳 企骸 .


SQL #

一危 襷り鍵
select 1 seq, '譴覿襯1' h into #temp union all
select 2, '覿襯1' union all
select 3, '覿襯2' union all
select 4, '覿襯3' union all
select 5, '譴覿襯2' union all
select 6, '覿襯4' union all
select 7, '譴覿襯3' union all
select 8, '覿襯5' 

;with new_idx
as
(
    select
        h
    ,   seq
    ,   isnull(lead(seq, 1) over(order by seq), 99999) - 0.5 new_seq
    from #temp 
    where h like '譴%'
)
select 
    a.seq
,   a.h
from #temp a
    left join new_idx b
        on a.seq = b.seq
order by 
    isnull(b.new_seq, a.seq)
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:53

伎 願 願 願 伎 伎螳.