Hi,
I know what the left outer joing does but what is its purpose here?
ALTER procedure YourCompany_EventModTest_GetEvent
@ItemId int,
@ModuleId int
as
select
YourCompany_EventModTest.ItemId,
YourCompany_EventModTest.ModuleId,
YourCompany_EventModTest.Description,
YourCompany_EventModTest.DateTime,
YourCompany_EventModTest.Title,
YourCompany_EventModTest.ExpireDate,
'CreatedByUser' = Users.FirstName + ' ' + Users.LastName,
YourCompany_EventModTest.CreatedDate,
YourCompany_EventModTest.Every,
YourCompany_EventModTest.Period,
'IconFile' = case when Files.FileName is null then YourCompany_EventModTest.IconFile else
Files.Folder + Files.FileName end,
YourCompany_EventModTest.AltText
from YourCompany_EventModTest
left outer join Users on YourCompany_EventModTest.CreatedByUser = Users.UserId
left outer join Files on YourCompany_EventModTest.IconFile = 'fileid=' + convert(varchar,dbo.Files.FileID)
where ItemId = @ItemId
and ModuleId = @ModuleId
I would understand that if we use the join to grab data from the users table based on the user id but its only selecting the fields from the EventModTest table. BTW, this is the default behavior of this script.
thanks,
John