select id,name,type from A union all 
select id,name,type from B union all 
select id,name,type from C union all  where ???
----------------------------------------------------
 1,张三,会员
 2,李四,钻石
 7,王五,普通
 3,张三,会员
 5,张三,会员
---------------------------------------
 查询时 “会员” 的用户列 
   Where 后面怎么写
     type='会员' 不行

解决方案 »

  1.   

    A.type = '' or B.type='' or C.type=''
      

  2.   

    SELECT * FROM (
    select id,name,type from A union all 
    select id,name,type from B union all 
    select id,name,type from C
    )T where [TYPE]='会员'
      

  3.   

    select id,name,type from A where [TYPE]='会员'
    union all 
    select id,name,type from B where [TYPE]='会员'
    union all 
    select id,name,type from C where [TYPE]='会员'
      

  4.   

    select * from(
    select id,name,type from A union all  
    select id,name,type from B union all  
    select id,name,type from C) t where  type='会员' 
      

  5.   

      不行。。
        我有多个查询条件。。
          比如我名称和类型一起查那SQL语句就N长了
      

  6.   

    我的type是用函数转换过来的
       type没有给它取个别名
      

  7.   

    括号里的第一个SELECT语句的所有列都必须有明确的列名,如
    SELECT * FROM (
    select id,name,type,TYPE 'TYPE2',TYPE 'TYPE3' from A union all
    select id,name,type,TYPE,TYPE from B union all
    select id,name,type,TYPE,TYPE from C
    )T where [TYPE]='会员'