Advertisement
Guest User

Untitled

a guest
Nov 16th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.77 KB | None | 0 0
  1. SELECT  REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(P.NumeCelu,'FC',''),'F',''),'CL',''),'TEC',''),'P','') matricula,
  2.         AC.DataAces  AS data_acesso
  3. FROM [Suricato].[suricato].[TbPessoa] P (NOLOCK)
  4. INNER JOIN [suricato].[suricato].[TbColab] C (NOLOCK)
  5.     ON P.IdPessoa = C.IdPessoa
  6. INNER JOIN [Suricato].[suricato].[TbHistoFilia] FI (NOLOCK)
  7.     ON FI.IdColab = C.IdColab
  8. INNER JOIN [Suricato].[suricato].[tbmarcaacess] AC (NOLOCK)
  9.     ON AC.Icard = FI.Icard
  10. INNER JOIN [Suricato].[suricato].[tbtipoacess] TA (NOLOCK)
  11.     ON TA.TipoAces = AC.TipoAces
  12. INNER JOIN ACADEMICO_COLEGIO.dbo.Matricula M (NOLOCK)
  13.     ON CONVERT(VARCHAR(20),M.matricula)+'CL' = P.NumeCelu
  14. WHERE P.NumeCelu LIKE '%CL'
  15. AND M.digito = 'CL'
  16. AND TA.DescTipoAces LIKE '%Acesso Permitido%'
  17. GROUP BY P.NumeCelu,AC.DataAces
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement