select t1.临时编号,t2.* from T1,T2
where t1.临时编号=2
and t1.编号=t2.编号
union all
select t1.临时编号,t2.* from T1,T3
where t1.临时编号=3
and t1.编号=t3.编号
union all
select t1.临时编号,t2.* from T1,T4
where t1.临时编号=4
and t1.编号=t4.编号

解决方案 »

  1.   

    select A.字段 (select * from 2表 union all select * from 3表 union all select * from 4表) A join 1表 B on A.编号=B.编号 where B.临时编号=@参数
      

  2.   

    select A.字段 from (select * from 2表 union all select * from 3表 union all select * from 4表) A join 1表 B on A.编号=B.编号 where B.临时编号=@参数
      

  3.   

    大力    A 代表什么,     B又代表什么 ?  执行不过去。说form子句错误
      

  4.   

    Haiwer(海阔天空)的也不错:
    select t1.临时编号,t2.* from T1,T2
    where t1.临时编号=@参数
    and t1.编号=t2.编号
    union all
    select t1.临时编号,t2.* from T1,T3
    where t1.临时编号=@参数
    and t1.编号=t3.编号
    union all
    select t1.临时编号,t2.* from T1,T4
    where t1.临时编号=@参数
    and t1.编号=t4.编号
    大力的更改为:
    select A.字段 from (select 编号,姓名,成绩 from 表2 union all select * from 表3 union all select * from 表4) A join 表1 B on A.编号=B.编号 where B.临时编号=@参数
      

  5.   

    欧乐   form 字句错。   A ,B  分别表示什么?
      

  6.   

    A,B 分别表示别名例:select * from TableName [as] A
    where A.col1 = '1'等同与select * from TableName 
    where TableName.col1 = '1'在以后调用就可以用别名A来代替表名了。