我有一個SQL查詢,如下所示:的LINQ to SQL查詢
Declare @DivisionNo INT
SET @DivisionNo = 5117
SELECT distinct CASE WHEN ISNULL([DivisionNo],'') <> @DivisionNo
THEN @DivisionNo ELSE [DivisionNo] END as DivisionNo
--,[RecordID]
,[AcctCat]
,[AcctCatDesc]
,[CostCode]
,[CostCodeDesc]
FROM [dbo].[vw_eSchdl_AcctCat_CostCode]
WHERE DivisionNo = @DivisionNo
UNION
SELECT distinct CASE WHEN ISNULL([DivisionNo],'') <> @DivisionNo
THEN @DivisionNo ELSE [DivisionNo] END as DivisionNo
--,[RecordID]
,[AcctCat]
,[AcctCatDesc]
,[CostCode]
,[CostCodeDesc]
FROM [dbo].[vw_eSchdl_AcctCat_CostCode]
WHERE AcctCat not in (
SELECT [AcctCat]
FROM [dbo].[vw_eSchdl_AcctCat_CostCode]
WHERE DivisionNo = @DivisionNo
)
使用LINQ to SQL的它怎麼能我重複?
感謝
你嘗試過什麼?你可以得到一部分,但卡住某處?你可以發佈你有什麼?哪一位給你帶來問題?或者你不知道從哪裏開始? – 2010-04-14 18:24:15