USE [DataPRO]
GO

/****** Object:  UserDefinedFunction [dbo].[foo_GetIdenticalGroupChannelSettingsCount]    Script Date: 1/25/2019 2:35:12 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO





CREATE FUNCTION [dbo].[foo_GetIdenticalGroupChannelSettingsCount]
(
	@ChannelId1 BIGINT,
	@ChannelId2 BIGINT
)
RETURNS int
AS
BEGIN
	return (
	SELECT COUNT(*)
    FROM [DataPro].[dbo].[GroupChannelSettings] G1,
	     [DataPro].[dbo].[GroupChannelSettings] G2
	WHERE G1.ChannelId = @ChannelId1
	  AND G2.ChannelId = @ChannelId2
	  AND G1.SettingId = G2.SettingId
	  AND G1.SettingValue = G2.SettingValue
	  )
END


GO

