-- get username from company select username,* from users where companycode LIKE '%Fragr%' and isdeleted = 0 order by lastlogintimestamp desc select * from AnnotationHarvestJobLogs ahjl where id = 74348 --check device exist or not select IP, companyname, branchname, LastHeartBeatDateTime, companyserial, serial, patchversion, AllocationDateTime, Verification_StartDateTime, server from CounterHealthChecks where -- IP like '%172.50.19.70%' -- branchname LIKE '%Edith%' AND -- companyname like '%City Campus%' -- companySerial = '25F010003005' -- companyname like '%elmec%' serial = 'c6f093882c3718b4' and IP IS NOT NULL order by IP asc -- check device select serial, * from CounterHealthChecks CHC where companyname like '%Frag%' and branchname like '%Livingston Outlet%' DECLARE @companycode as NVARCHAR(MAX) SET @companycode = '%#%' DECLARE @companyname as NVARCHAR(MAX) SET @companyname = '%Orange%' DECLARE @companyid as INT SET @companyid = null select ID, CompanyCode, CompanyName, IsDeleted, IsDeactivated, ResellerId from Companies where companycode like @companycode or companyname like @companyname or id = @companyid SELECT ID, COMPANYCODE, USERNAME, NAME, USERROLE, EMAIL, ISDELETED, ISDEACTIVATED, ISDEMOACCOUNT , VIEWV9LAYOUT FROM RETAILCAMCONTROLPANEL.DBO.USERS U WHERE COMPANYCODE LIKE 'OrangeMorocco' ORDER BY LastLoginTimestamp DESC -- Edith select case when DATEDIFF(day, chc.LastHeartbeatDateTime, GETDATE()) <= 1 then 1 else 0 end as IsOnline, serial, companyserial, LastHeartBeatDateTime, Verification_Tuner, AllocationDateTime, server --CounterFirstAllocationDateTime from CounterHealthChecks CHC where companyname like '%Edith%' and branchname like '%City Campus%' --AllocationDateTime like '%1970%' --order by CHC.CounterFirstAllocationDateTime desc select * from FFcameras where serial = '864ced90ed456b54'; -- check device select serial, * from CounterHealthChecks CHC where serial = '82888387c23e145c' -- check if patch updated (local counter, non Client-server device) select branchname, companyserial, serial, patchversion, server from ffcameras where companyserial in ( '25F010002739', '25F010003042', '25F010002345' ) select * from CompanySerialRelations where parentcompanyserial in ('24J010000076') select serial, * from ffcommissions where companyserial in ( '25X010000120', '25X010000121', '25X010000119' )