如何从一个表中根据编号获取姓名再插入另一个表中

解决方案 »

  1.   

    insert into b(姓名) select 姓名 from a where a.编号=1;
      

  2.   

    恩,只要插入和查询列对应(顺序和类型)就可以了
    insert into b(a,b) select c,e from a where a.编号=1;
      

  3.   

    "insert into liuyanbiao (学号,发送者姓名) select 学号,姓名 from student  where 学号='"+xh+"'";我执行这条语句了 ,运行出来说‘,’号附近有问题
      

  4.   

    你这是中文逗号,改成英文逗号
    "insert into liuyanbiao (学号,发送者姓名) select 学号,姓名 from student where 学号='"+xh+"'";
      

  5.   

    我知道啊,可是我显示留言表的时候有发送者姓名啊,还要插入标题,内容写成一条SQL语句 ,
    然后就不知道怎么写了
      

  6.   

    insert into aa values('select name from bb where id=1')