Table 1
CREATE TABLE IF NOT EXISTS `modx_profut_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) DEFAULT NULL,
`role` int(11) DEFAULT '0',
`team_id` int(11) DEFAULT '0',
`league_id` int(11) DEFAULT '0',
`way_id` int(11) DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `uid` (`uid`)
) ENGINE=MyISAM AUTO_INCREMENT=451 DEFAULT CHARSET=utf8;
and Table 2
CREATE TABLE IF NOT EXISTS `modx_profut_teams` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` text NOT NULL,
`logo` text NOT NULL,
`tagline` text NOT NULL,
`datetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=90 DEFAULT CHARSET=utf8;
This tables linked by fields
modx_profut_users.team_id =
modx_profut_teams.id, but a few users may have the same
team_id.
How i select
all rows from
modx_profut_teams where
modx_profut_users have a
league_id = 1?
For get all rows without criterias i'm use this code:
$c = $modx->newQuery('ProfutTeams');
i try to add
$c->leftJoin('ProfutUsers', 'ProfutUsers', 'ProfutUsers.league_id = 1');
but this don't work ;(