1,
insert into color
select color1,color1 as color2,color1 as color3 from color where color2 not in (select color1 from color)

解决方案 »

  1.   

    2,
    select color1,color2,color2 as color3 from color 
     where color2 not in (select color3 from color)
      

  2.   


    insert into color
    select color1,color2 ,color3 = color2
    from color 
    where color2 not in(select color3 from color)
      

  3.   

    题目要求是两个问题用一条SQL语句完成,不是分开吧?
      

  4.   

    insert into color
    select color1,color1 as color2,color1 as color3 from color where color2 not in (select color1 from color)
    unoin
    select color1,color2,color2 as color3 from color 
     where color2 not in (select color3 from color)
    这样一句行吗?
      

  5.   

    insert into color
    select color1,color1 as color2,color1 as color3 from color where color1 not in (select color2 from color)
    unoin
    select color1,color2,color2 as color3 from color 
    where color2 not in (select color3 from color)这样就对了,^_^,谢谢
      

  6.   

    “而color1为原来color2所对应的颜色”这句话不明白,什么叫原来COLOR2的颜色啊原来COLOR2的颜色不就是这种颜色么?那不又成了RED,RED,RED?
      

  7.   

    这句话我理解为符合“对于某一种颜色,它存在于color2中,而不在color3中”条件的记录
    中color1的颜色,而不color2的颜色
      

  8.   

    create table #t(color1 char(10),color2 char(10),color3 char(10))insert #t values('black','blue', 'green')
    insert #t values('red', 'Blue', 'Yellow')
    insert #t values('white', 'green', 'white')
    insert #t values('black', 'Blue', 'green')
    1.insert #t
    select color1,color1 as color2 ,color1 as color3
    from #t 
    where color1 not in (select color2 from #t)2 insert #t
    select color1,color2  ,color2 as color3
    from #t 
    where color2 not in (select color3 from #t)