Skip to content
Advertisement

How do I narrow down SQL query results?

For my big SQL class project, I’m creating a database based on the character classes in World of Warcraft Classic. 8 races, 9 classes, 3 specs per class, and each spec falls into a specific role (Melee damage, spell damage, healing, tank, pet).

I created tables based on all of this and added fake players, and the database came out beautifully. My problem is running queries. If I try searching for just healers, it’ll pull up EVERY Priest, Paladin, Shaman, and Druid in the database when I only want characters with the Discipline, Holy, or Restoration specs.

This is my code for the character class table:

This is my code for the spec table:

And this is my query:

EDIT: Here are the query results. I forgot to mention that some of the results are duplicates for some reason, so I’m open to any suggestions on that as well:

enter image description here

I can’t figure out if the problem is with the query or the table structure. Any help would be much appreciated.

Advertisement

Answer

You’re storing SpecName in TOON and in TOONSPEC, but you’re not using it when filtering. You need to add an AND to your filtering clause:

Or, if SpecName are unique among classes, just

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement