I've got a nice database set up for a TV show.
I've got episodes in one table, actors in another, and roles in a third, and I've got a table of actor_role_ep mappings, and that all works well and is normalised as far as I can make it.
My problem comes in special cases: there's one role which was played by two different actors, and there's a couple of actors who have played two different roles.
If there was always a one-to-one mapping, I'd just go "the character Joe Smith, played by Jack Jones, appears in the following eps:" then list them.
But in the special cases, I don't know how to test for "all appearances played by same guy" or "all appearances in show are as same character" except by going through the whole hashref and saying "if actor ne previous actor" kind of thing -- testing each value to see they're all the same. Or, of course, hand-coding the exceptions in like "if id=473, do something different" which would be kind of lame.
What can I do to select the appearances in a smart SQL way and get an immediate answer to "does more than one actor play this role?"?
($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss') =~y~b-v~a-z~s; print
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |