Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagesql
themeMidnight
titleVariation, with date and two database types
SELECT c.Label
       , c.Username
       , o.Name as Outcome
       , ch.[IPAddress]
       , c.Instance     -- Instance for MS SQL is less useful than for Oracle, but still interesting
       , p.Name as [Project Name]
       , ch.AttemptDate
FROM [history].[t_ConnectionHistory] ch 
	INNER JOIN config.t_Credential c ON ch.CredentialID = c.CredentialID
    INNER JOIN config.t_Outcome o ON ch.OutcomeID = o.OutcomeID  
    INNER JOIN jobs.t_JobLocationProjectIPRange AS jobProj ON jobProj.JobID = ch.JobID
	join config.t_Project p on jobProj.ProjectID =p.ProjectID
WHERE ( (Connection = 'Oracle Database' ) OR (Connection = 'MS SQL server') )
  AND p.ProjectID = '1'
  AND convert(DATE,AttemptDate) = '2018-05-01'

...