This is a discussion on Finding missing entries between two tables linked by a link table within the MySQL forums, part of the Database Server Software category; --> Hi, I have three tables as follows - TestCase (Table Name) Id (Primary Key) Name Scenario (Table Name) Id ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I have three tables as follows - TestCase (Table Name) Id (Primary Key) Name Scenario (Table Name) Id (Primary Key) Name TestCaseToScenario (Table Name) TestCaseId ScenarioId Therefore each Scenario is associated with zero or one Test Cases. What search could I use to find Test Cases with no Scenarios. Thanks for your help, Aine |
| ||||
| On 31 Aug, 09:14, aine_ca...@yahoo.com wrote: > Hi, > > I have three tables as follows - > > TestCase (Table Name) > Id (Primary Key) > Name > > Scenario (Table Name) > Id (Primary Key) > Name > > TestCaseToScenario (Table Name) > TestCaseId > ScenarioId > > Therefore each Scenario is associated with zero or one Test Cases. > > What search could I use to find Test Cases with no Scenarios. > > Thanks for your help, > > Aine I don't agree with the statement: "Therefore each Scenario is associated with zero or one Test Cases." The table structure that you have shown supports the statement: "Therefore each Scenario is associated with zero, one or many Test Cases." If there can really be only 0 or one testcases for a scenario then the structure: Scenario (Table Name) Id (Primary Key) TestCaseId Name TestCase (Table Name) Id (Primary Key) Name supports this much better. In either case a LEFT JOIN with a test to see if the JOINed to id IS NULL is the way to go. |