ALTER PROCEDURE [dbo].[sp_User_not_regestired_companies]
@userId as int
AS
BEGIN
select CompanyId, Name
from Company
except
select CompanyId, Name
from SecurityUserCompanyLevel
where UserId = @userId
END
我的问题是当我在select子句中写CompanyId
时,它将返回正确的答案。当我在select子句中写Name
时,它将返回所有公司的列表