猿问

sql server 两表表合并

我是查询出来的两张数据表,现在需要合并为一张表方便使用,请看sql语句

SELECT  A.User_Name  ,A.PhoneNo  ,A.OICQ  ,C.RoleCode  ,D.Value AS RoleName  ,G.CompanyName  ,G.Address AS CompanyAddress  ,G.Telephone AS CompanyTel,F.PropertyInstance_Value FROM  Base_UserInfo A LEFT JOIN  Base_UserRole B ON  A.User_ID = B.User_ID LEFT JOIN  Base_Roles C ON  B.Roles_ID = C.Roles_ID LEFT JOIN  TMSTCommonData D  ON C.RoleCode = D.Code AND D.CodeKey = 'ChatUserRole',  TMSTCompany G,Base_AppendPropertyInstance F WHERE A.CompanyCode = G.CompanyCode
  AND (A.User_ID=F.PropertyInstance_Key  AND F.Property_Control_ID='QrWeChatPath')  AND A.User_Account = '18381091656'

 

 SELECT F.PropertyInstance_Value as Usercode from Base_UserInfo A,Base_AppendPropertyInstance F where A.User_Account='18381091656' and A.User_ID=F.PropertyInstance_Key
  AND F.Property_Control_ID='PromotionCode'

有人私下帮我解决下更好,我可以给你发图详细看

Helenr
浏览 402回答 2
2回答
随时随地看视频慕课网APP

相关分类

SQL Server
我要回答