Tuesday, February 3, 2009

SQL: joint statment on 3 different tables

select distinct u.email from user u join season_roster sr on u.id=sr.user_id join team t on t.id=sr.team_id where t.league_id in (3, 13) and u.email like '%@%'  and u.email not like '%test.com';