I've got this stored procedure, and when I add the join I get no results. Is this because the column used for the join condition, ForClientID, is null? Would that affect the results of the table? If i select the table with Appointment.ForClientID instead of Client.Name, the rest of the table loads with the ForClientID column being null. Thanks in advance, this is an amazingly helpful community.
Create procedure GetAppointmentsByProfessionalName(@ProfessionalName varchar(256))
as
declare @ProfessionalID uniqueidentifier
set @ProfessionalID = (select UserId from aspnet_Users where UserName = @ProfessionalName)
select Appointment.AppointmentID as 'Appointment ID',
Client.Name as 'Client Name',
CONVERT(VARCHAR(10),Appointment.ProposedDate,111) as 'Date',
CONVERT(CHAR(8), Appointment.ProposedTime, 114)as 'Time',
Appointment.ClientDescription as 'Client Notes',
Appointment.Confirmed as 'Confirmed Appointment'
from Appointment join Client on Client.ClientID = Appointment.ForClientID
where Appointment.ForProfessionalID = @ProfessionalID
go