----插入b表不存在的﹕
insert into b select a.uid from a left join b on a.uid=b.uid where b.uid is null
---查詢A,B所有字段的值。
select a.*,b.* from a inner join b  on a.uid=b.uid

解决方案 »

  1.   

    如果A表有而B表没有,则应向B表添加一行:
    insert into b select * from a where uid not in (select uid from b)余下的问题没看明白 :(
      

  2.   

    --insert tableB
    insert into B select * from A where not exists (select * from B where uid=A.uid)
    --query
    select a.*,b.* from a inner join b  on a.uid=b.uid
      

  3.   


    insert into b select a.uid from a M where not exists (select 1 from b where uid=M.uid)--下面不太明白!
    B表有许多,名字不固定,根据不同的情况给出不同的表名,也可以通过查询C表得出。
    要求返回UID,以及A表,B表的其它所有字段的值
      

  4.   

    看清楚了啊,B表是泛指,也就是说,B表名是通过变量给出的。但保证所给出的B表的结构都是固定的
    然而,B表的表名也存在于另一表内: C表。C表通过一个ID号可以从字段TableName来得到B表的表名