我是查詢出來的兩張數據表,現在需要合并為一張表方便使用,請看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'
有人私下幫我解決下更好,我可以給你發圖詳細看
sql server 兩表表合并
Helenr
2018-12-07 11:25:39