7 thg 6, 2017


so sánh hai bảng

USE [TN_DB]
GO
/****** Object:  StoredProcedure [dbo].[spXuatDiem_Ngay]    Script Date: 06/07/2017 10:14:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[spXuatDiem_Ngay]

@NgayThi nvarchar(50)
AS
BEGIN
SELECT DISTINCT a.DateTimeS  FROM  BaithiTam  a
LEFT JOIN Baithi b
ON a.DateTimeS =  b.DateTimeS
WHERE  CONVERT (varchar(10),a.DateTimeS,103) = @Ngaythi
EXCEPT

SELECT DISTINCT a.DateTimeS  FROM  BaithiTam  a
RIGHT JOIN Baithi b
ON a.DateTimeS =  b.DateTimeS WHERE CONVERT (varchar(10),a.DateTimeS,103) = @Ngaythi
END
--SELECT DISTINCT a.DateTimeS  FROM  BaithiTam a WHERE a.DateTimeS LIKE '07/06/2017%'

--SELECT DISTINCT a.DateTimeS  FROM  Baithi a WHERE a.DateTimeS LIKE '07/06/2017%'
/*
exec [spXuatDiem_Ngay]
@NgayThi = '07/06/2017'

*/

Rating: 4.5 Diposkan Oleh: http://pdunoteit.blogspot.com/