我MS SQL Serverstored procedure是:如何使用內部聯接選擇沒有重複的行?
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_close]
@DATE NVARCHAR(8)
AS
BEGIN
SELECT appointment_datas.appointment_date
,appointment_datas.appointment_no
,costumer_datas.costumer_name
,appointment_datas.appointment_type
,personel_datas.personel_ADI
FROM [LONI].[dbo].appointment_datas
INNER JOIN [LONI].[dbo].costumer_datas ON appointment_datas.appointment_costumer = costumer_datas.costumer_id
INNER JOIN [LONI].[dbo].personel_datas ON appointment_datas.appointment_personel = personel_datas.personel_id
INNER JOIN [GUONU].[dbo].dayend ON appointment_datas.appointment_no <> dayend.appointment_no COLLATE Turkish_CI_AS
WHERE CONVERT(nvarchar(8),appointment_datas.appointment_date,112) = @DATE
END
有了這個代碼,我選擇相同的記錄重複行。實際上,我想從[LONI]。[dbo] .appointment_datas中選擇字段,但如果appointment_no 不在[GUONU]。[dbo] .dayend
請使用空格來縮進代碼,使其代碼塊。 – 2009-11-30 20:22:58
看起來這是社區模式與大家重新格式化:O – Andomar 2009-11-30 20:27:58
@Andomar:必須是一個10K的東西?我無法將問題更改爲社區維基... – 2009-11-30 20:32:31