如下:
写一SQL语句,向表Tab1中Col1字段插入表Tab2中所有Col2为"red"的行的Col3字段;

解决方案 »

  1.   

    我这样理解:在表tab2中找所有col2为"red"的行,然后后将其col3的的值放到tab1的col1字段中
      

  2.   

    DECLARE @T1 TABLE(COL1 VARCHAR(1))
    DECLARE @T2 TABLE(COL2 VARCHAR(5),COL3 VARCHAR(1))
    INSERT @T2 SELECT 'red','A'
    UNION ALL SELECT 'red','B'
    UNION ALL SELECT 'red','C'
    UNION ALL SELECT 'black','A'
    INSERT @T1(COL1) SELECT COL3 FROM @T2 WHERE COL2='red'
    SELECT * FROM @T1COL1 
    ---- 
    A
    B
    C
      

  3.   

    insert into tab1(col1) select col3 from tab2 where col2='red'
      

  4.   

    --从后往前理解
    --1:找到tab2中所有Col2为"red"的行的Col3字段
    select col3 from tab2 where col2='red'
    --2:插入到tab1的col1字段中
    insert tab1(col1)select  col3 from tab2 where col2='red'
      

  5.   

    表Tab2中所有Col2为"red"的行的Col3字段;
    ------------------------------------------
    说明可能不只一行,有N行insert into tab1(col1)select  col3 from tab2 where col2='red'
    把N行插入到一个字段中,结果是怎样的?
      

  6.   

    --写一SQL语句,向表Tab1中Col1字段插入表Tab2中所有Col2为"red"的行的Col3字段;
    insert into Tabl1(Col1) select Col3 from Tab2 where Col2='red'
      

  7.   

    有N行就在tab1生成N行
    可以看2楼的测试数据
      

  8.   

    insert into tab1(col1) select col3 from tab2 where col2 = 'red'
      

  9.   

    这个好像在考试语文理解能力,干脆弄个文言文让翻译一下多好!写的这么复杂,有意思〉!insert into tab1(col1) select col3 from tab2 where col2 = 'red'
      

  10.   

    insert into tab1(col1) select col3 from tab2 where col2='red'
      

  11.   

    insert into tab1(col1) select col3 from tab2 where col2 = 'red'
      

  12.   

    我理解是:
    先找到表Tab2所有Col2字段为"red"所对应的Col3字段行,再把Col3字段行的数据插入表Tab1中Col1字段
    insert into Tab1
              select Col3 from Tab2
              where Col2='red'
      

  13.   

    写一SQL语句,向表Tab1中Col1字段插入表Tab2中所有Col2为"red"的行的Col3字段;insert into Tab1
    select Col3 from Tab2
    where Col2='red'应该是这样吧?
      

  14.   


    insert tab1(col1) select col3 from tab2 where col2 = 'red'
      

  15.   

    写一SQL语句,向表Tab1中Col1字段插入表Tab2中所有Col2为"red"的行的Col3字段
      

  16.   

    insert tab1(col1) select col3 from tab2 where col2 = 'red' 这个我认为很简单啊
      

  17.   

    insert into tab1(col1) select col3 from tab2 where col2='red'
      

  18.   

    写一SQL语句,向表Tab1中Col1字段插入表Tab2中所有Col2为"red"的行的Col3字段;insert into tab1 (col1)
    select col3 from tab2 where col2='red'
      

  19.   

    insert into tab1 (col1) 
    select col3 from tab2 where col2='red'
      

  20.   


    - -!我怎么觉得这问题本身就有问题!!Col2是字段吧?"red"的行是Col2的值吗?那这个Col2"red"的行的Col3字段是哪来的?本人技术不行,问题比较多,望指教!!
      

  21.   

    insert into tab1(col1) select col3 from tab2 where col2='red'
      

  22.   

    。。lz水
    insert into tab1(col1) select col3 from tb2 where col2='red'