Cody Pendant has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: SQL query: are all results in one hashref key the same?
by Yendor (Pilgrim) on Oct 11, 2003 at 02:30 UTC | |
|
Re: SQL query: are all results in one hashref key the same?
by perrin (Chancellor) on Oct 10, 2003 at 23:29 UTC | |
by Cody Pendant (Prior) on Oct 11, 2003 at 04:07 UTC | |
by etcshadow (Priest) on Oct 12, 2003 at 01:15 UTC | |
by Cody Pendant (Prior) on Oct 12, 2003 at 04:40 UTC | |
by etcshadow (Priest) on Oct 13, 2003 at 01:42 UTC | |
by Anonymous Monk on Oct 11, 2003 at 21:54 UTC |