SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
alter PROCEDURE [dbo].[TCCPAUsersAndNamesByJobPosition] @EmpOrfreeLance bit
AS
BEGIN
SET NOCOUNT ON;
SELECT distinct t1.UserId , tblCustomers.name
FROM tblTime t1
inner join tblCustomers on t1.UserId=tblCustomers.custID
where (t1.userid in (select distinct custID from tblCustomers where sectionCat Like '%,35%'))
AND (t1.UserId in (select distinct custID from tblCustomers where IsEmployee = @EmpOrfreeLance))
end
試了一下還與IsEmployee = CONVERT(bit,@EmpOrfreeLance)
SQL Server查詢與布爾問題
和SET @EmpOrfreeLance= CASE @EmpOrfreeLance WHEN 1 THEN 0 ELSE 0 END
同一切retuns具有相同的結果相同的列表無論什麼
它不應該是簡單的? ??
IsEmployee
COL-數據類型爲(bit,null)
我開發的SQL服務器2008 ..online服務器是2005年它應該是一個問題...
您可以在'IN'中刪除select中的'distinct'關鍵字,因爲它不會執行任何操作。 – Magnus
@Magnus謝謝,已完成,但我將保留它,因爲它與您的評論一起作爲一個沒有效果的例子。 – LoneXcoder