insert into RoleAuth (role_id,auth_id) values(?,?)
第一个参数是固定的,假定‘10001’,第二个参数要由后面的查询得出,请问能嵌套吗?
select auth_id from Authority where mod_id='10001' and func_id='10001'

解决方案 »

  1.   

    insert into RoleAuth (role_id,auth_id) select '10001',auth_id
    from Authority 
    where mod_id='10001' and func_id='10001'
      

  2.   

    select *******
    into 表
    from 表2
    where ********
      

  3.   

    insert into RoleAuth (role_id,auth_id) 
    select '10001' , auth_id from Authority where mod_id='10001' and func_id='10001'
      

  4.   

    2楼的 莫非是要写成
    select'10001',auth_id into RoleAuth  from Authority where mod_id='10002' and func_id='10001'
    这样,好像不对啊?主键是自增长的
      

  5.   

    将后面查出来的结果用变量存起来!
    将变量填入insert语句中
      

  6.   

    你那样写语法是错的insert into RoleAuth (role_id,auth_id)  
    select ''/*如果是主键就空在这里*/ , auth_id from Authority where mod_id='10001' and func_id='10001'
      

  7.   

    select ******* 
    into 表1 
    from 表2 
    where ******** 
    适用于直接创建并插入新表insert into 表1(****)
    select *****
    from 表2
    where *****
    插入存在的表1