|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
SQL Query Help
I can query individual characters to get all the scenes they are in and can restrict it based on setting just fine.
But I can't figure out a way to get only scenes that have two or more specific characters in them. Here's the query I run for getting individual character scenes. SELECT `Episode Scenes`.Season, `Episode Scenes`.Number, `Episode Scenes`.Time, `Episode Scenes`.Setting FROM `Appearances`, `Episode Scenes` WHERE `Appearances`.Time = `Episode Scenes`.Time AND `Appearances`.Season = `Episode Scenes`.Season AND `Appearances`.Number = `Episode Scenes`.Number AND `Episode Scenes`.Setting = 'Bridge' AND `CharacterCode` = 'WORF' That returns all the scenes that have Worf on the Bridge. But let's say I want to restrict it to get only Bridge scenes with Riker, Worf, and Troi. I can't figure out how to do that!! If I try to run the search I get every scene that all those characters are in, not every scene with that exact combination of characters. Here's my schema again for quick reference: (stars denote primary keys) (I'm only querying from Episode List and Appearances for now) Character {*CharacterCode, Name, Rank} Episode List {*Season, *Number, Name, Disc, Title, Synopsis} Featuring {*Season, *Number, *CharacterCode} Episode Scenes {*Season, *Number, *Time, Setting, Trailer, Memorable} Appearances {*Season, *Number, *Time, *CharacterCode} |
|
#2
|
|||
|
|||
|
I forgot to paste it in, but this is a database for storing episodes of Star Trek. I want to able to store every individual scene of every episode and be able to search for particular characters in a particular place and have that info sent back to me in the form of what episode and time of that episode they're in.
Thanks for any help you can provide! |
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > SQL Query Help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|