如何重命名MySQL查询结果

时间:2017-07-19 05:55:26

标签: mysql

如何重命名查询的输出? 我有这个问题:

   select * 
   from (generalprofile left join applicant on applicant.profileID = 
   generalprofile.profileID) as A 
   inner join (generalprofile left join applicant on applicant.profileID = 
   generalprofile.profileID) as B on A.applicationID = B.applicationID ;

我需要内部加入2个查询的结果。 “AS”似乎无法正常工作

1 个答案:

答案 0 :(得分:1)

您没有以正确的方式构建选择表
在()中你必须放置一个有效的选择..不仅是表名和连接

  select * 
   from ( select * form generalprofile 
          left join applicant on applicant.profileID = 
   generalprofile.profileID) A 
   inner join (select * from generalprofile 
          left join applicant on applicant.profileID = 
   generalprofile.profileID) B on A.applicationID = B.applicationID ;