用户示例:
==================
Username UserId
---------- --------
A 1
B 2
===============
和另一个像这样的表:
================================================
sendUserId insertUserId printUserId .....
--------------------------------------------
1 2 1
================================================
我如何创建视图以选择用户信息:
sendUserName insertUserName printUserName
============================================
A B A
答案 0 :(得分:1)
您可以在下面尝试-通过如下所示加入用户表的多个实例
select u1.Username as sendUserName,u2.Username as insertUserName
,u3.Username as printUserName
from anothertable
inner join user u1 on sendUserId=u1.userid
inner join user u2 on insertUserId=u2.userid
inner join user u3 on printUserId=u3.userid