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='会员' 不行
select id,name,type from B union all
select id,name,type from C union all where ???
----------------------------------------------------
1,张三,会员
2,李四,钻石
7,王五,普通
3,张三,会员
5,张三,会员
---------------------------------------
查询时 “会员” 的用户列
Where 后面怎么写
type='会员' 不行
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]='会员'
union all
select id,name,type from B where [TYPE]='会员'
union all
select id,name,type from C where [TYPE]='会员'
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='会员'
我有多个查询条件。。
比如我名称和类型一起查那SQL语句就N长了
type没有给它取个别名
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]='会员'