您好我已经在 SQL-SERVER 中创建了一个视图,并且我还希望能够在该视图的返回结果中添加一列。
这是我的代码:
ALTER VIEW [eConnect].[GetStudentTeachers]
AS
select
srmitv.StudentId as StudentId,
srmitv.TeacherAlias as Alias,
srmitv.TeacherAvatarFileName as AvatarFileName,
srmitv.TeacherMessageUserId as MessageUserId,
srmitv.TeacherUserName as UserName,
sp.Sex as Gender,
from
StudentRegularModuleInstanceTeachersView srmitv
inner join Sync_Persons sp on srmitv.TeacherId = sp.TeacherID and sp.Deletion_Date is null
union
select
somirtv.StudentId as StudentId,
somirtv.TeacherAlias as Alias,
somirtv.TeacherAvatarFileName as AvatarFileName,
somirtv.TeacherMessageUserId as MessageUserId,
somirtv.TeacherUserName as UserName,
sp.Sex as Gender
from
dbo.StudentOlcModuleInstanceRelatedTeachersView somirtv
inner join Sync_Persons sp on somirtv.TeacherId = sp.TeacherID and sp.Deletion_Date is null
GO
现在我想在这里添加另一列 RoleId 始终具有值 1。我怎样才能实现这一点?