1
嗨我已經在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
現在我想在此補充另一列是角色ID總是具有價值1.How我能做到這一點?
因爲它是一個聯盟,角色ID必須在兩個選擇 –
尼斯之一,補充說。 – hutchonoid