Hello and Happy New Year to everyone.
I had to make another change to this structure because for tv series the actor would be repeated hundreds of times with the same role. So now I thought of having 3 tables:
1 for actor name
1 for role with a key for the actor
and a junction table to tie it all together.
The problem is that I now have a junction table to tie in 3 tables (actor, dvdpedia, role) and am having some problems with it.
The simplest query works but returns repeated columns:
select dvdpedia.title, actor.actor, role.role FROM dvdpedia, actor, actor2role, role
WHERE actor.id = actor2role.actorId and dvdpedia.id = actor2role.titleId;
What would be the proper query here?
PS
This is the create tables syntax:
CREATE TABLE `actor` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`titleId` int(11) NOT NULL,
`actor` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
) ENGINE=MyISAM DEFAULT CHARSET=utf8
CREATE TABLE `actor2role` (
`actorId` int(11) NOT NULL DEFAULT '0',
`titleId` int(11) NOT NULL DEFAULT '0',
`roleId` int(11) NOT NULL,
PRIMARY KEY (`actorId`,`titleId`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
CREATE TABLE `role` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`actorId` int(11) NOT NULL,
`role` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8