Queries
11/27/2018 - 1:21 PM

BackRoom Sensor



SELECT [Divsion] ,Count(s_name) [SiteCount] FROM  
(
	SELECT b.s_Name,b.s_Addr_Street,s_Addr_District[District],s_Addr_Zone[Divsion],s_Addr_Zone[State], a.Mcuid,a.ItemName,a.CreatedOn 
	FROM 
		lbtsiteitemsmaster a  
	INNER JOIN
		lbtsitemas b 
	ON a.McuId = b.McuId
	WHERE Groupno = '03' AND unitNo = '02' AND a.mcuid = b.McuId and b.BankCode IN ('25', '16') 
		  AND b.s_Status='1' AND b.qStatus='1' AND a.qStatus='1' AND a.i_Status='1'
)c group by [Divsion]

SELECT [Divsion] ,Count(s_name) [SiteCount] FROM  (
select s_Name,s_Addr_Street,s_Addr_District[District],
s_Addr_Zone [Divsion],s_Addr_State[State],McuId from 
lbtsitemas where BankCode ='25' and qstatus = '1' and s_status ='1' AND s_Name NOT IN 
(
   SELECT b.s_Name
	FROM 
		lbtsiteitemsmaster a  
	INNER JOIN
		lbtsitemas b 
	ON a.McuId = b.McuId
	WHERE Groupno = '03' AND unitNo = '02' AND a.mcuid = b.McuId and b.BankCode IN ('25', '16') 
		  AND b.s_Status='1' AND b.qStatus='1' AND a.qStatus='1' AND a.i_Status='1'
))a Group by [Divsion]