sql 中如何用别名作为查询条件
两个sql语句是用union连接的,例如:selecta.idas'id',a.membernameas'name'b.suppliernameas'companynam...
两个sql语句是用union连接的,例如:
select a.id as 'id',a.membername as 'name' b.suppliername as 'companyname' from member a
inner join supplier b on a.supplierid=b.supplierid where company like'%某某%'
union
select a.id as 'id',a.membername as 'name' b.customername as 'companyname' from member a
inner join customer b on a.customerid=b.customerid where companyname like '%某某%'
像这样的查询怎么用别名作为查询条件啊 展开
select a.id as 'id',a.membername as 'name' b.suppliername as 'companyname' from member a
inner join supplier b on a.supplierid=b.supplierid where company like'%某某%'
union
select a.id as 'id',a.membername as 'name' b.customername as 'companyname' from member a
inner join customer b on a.customerid=b.customerid where companyname like '%某某%'
像这样的查询怎么用别名作为查询条件啊 展开
2个回答
展开全部
select * from (select a.id as 'id',a.membername as 'name' b.suppliername as 'companyname' from member a
inner join supplier b on a.supplierid=b.supplierid
union
select a.id as 'id',a.membername as 'name' b.customername as 'companyname' from member a
inner join customer b on a.customerid=b.customerid) a where companyname like '%某某%'
inner join supplier b on a.supplierid=b.supplierid
union
select a.id as 'id',a.membername as 'name' b.customername as 'companyname' from member a
inner join customer b on a.customerid=b.customerid) a where companyname like '%某某%'
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询