回覆列表
  • 1 # 紅淚偷垂秋風嶼南涼

    createtable#t(

    idint,

    achar(2),

    bchar(2),

    cchar(2),

    dchar(2)

    )

    go

    insertinto#t

    select1,"a1","b1","c1","d1"unionall

    select2,"a2","b2","c2","d2"unionall

    select3,"a3","b3","c3","d3"

    go

    1>select

    2>case

    3>whenrow_number()over(partitionbyidorderby[all])=1thencast(idasvarchar(2))

    4>else""endasid,

    5>[all]

    6>from

    7>(

    8>selectid,aas[all]from#t

    9>unionall

    10>selectid,bas[all]from#t

    11>unionall

    12>selectid,cas[all]from#t

    13>unionall

    14>selectid,das[all]from#t

    15>)t

    16>go

    idall

    -----

    1a1

    b1

    c1

    d1

    2a2

    b2

    c2

    d2

    3a3

    b3

    c3

    d3

    (12行受影響)

  • 中秋節和大豐收的關聯?
  • 帝國時代3亞洲王朝秘籍怎麼用?