Sample For 8729296 Version 2

0

Please login or register to vote for this query.

(click on this box to dismiss)

Enter Query Description

Bicycles

Q&A for people who build and repair bicycles, people who train cycling, or commute on bicycles

-- Sample For 8729296 Version 2
-- Enter Query Description

With SampleData AS 
(
SELECT 'Team1' as Team , '[email protected]' as email, 'A' as Groups
UNION SELECT 'Team1' as Team , '[email protected]' as email, 'B' as Groups
UNION SELECT 'Team1' as Team , '[email protected]' as email, 'C' as Groups
UNION SELECT 'Team2' as Team , '[email protected]' as email, 'A' as Groups
UNION SELECT 'Team2' as Team , '[email protected]' as email, 'B' as Groups
UNION SELECT 'Team2' as Team , '[email protected]' as email, 'C' as Groups
)

SELECT 
  source.Team,
    A.email,
    B.email,
    C.email
FROM 
  (SELECT DISTINCT TEAM From SampleData) source
  LEFT JOIN SampleData A 
  ON source.Team = A.Team
   AND A.GROUPS = 'A'
  LEFT JOIN SampleData B 
  ON source.Team = B.Team
  AND B.GROUPS = 'B'
  LEFT JOIN SampleData C 
  ON source.Team = C.Team
  AND C.GROUPS = 'C'

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results