回覆列表
  • 1 # 使用者9937787127551

    看一下我的示例,是不是對你有幫助。

    create table st_test ( id int ,name varchar(10),st varchar(100) )

    insert st_test ( id,name )

    select 1,"aa"

    union select 1,"bb"

    union select 1,"cc"

    union select 2,"dd"

    union select 3,"55"

    union select 3,"777"

    declare @c varchar(100)

    declare @id int

    declare cur_type cursor for

    select distinct id from st_test

    open cur_type

    fetch cur_type into @id

    while @@fetch_status = 0

    begin

    set @c = ""

    select @c = @c + name from st_test f where f.id = @id

    update st_test set st = @c

    where id = @id

    fetch cur_type into @id

    end

    close cur_type

    deallocate cur_type

  • 中秋節和大豐收的關聯?
  • 淺顏色的旅遊鞋、運動鞋,怎樣刷洗、晾曬,表面不會留黃痕?