View Single Post
  #3  
Old 06-25-2006, 11:26 AM
sesmar
I built it I will Support it!
 
Join Date: Jun 2005
Location: Michigan
Posts: 214
Default

The point of the Query is to find all Faction Tables (npc_faction entries) that are not referenced in npc_types.npc_faction_id.

By doing a LEFT JOIN to npc_types I am telling it I want all npc_faction.name and id regardless of whether or not it is in npc_types (hard for me to explain this so I hope you understand what I mean.)

So I am not really checking for NULLs in the npc_types table but rather for rows that a return a NULL in place of a npc_type.id because that means they are not being referenced in the table. It would be that same as this query:

Code:
SELECT
  npc_faction.id,
  npc_faction.name
FROM
  npc_faction
WHERE
  npc_faction.id NOT IN(SELECT npc_types.npc_faction_id FROM npc_types)
This query however also locks up my server and MySql 4 does not support sub queries so even if it did work it would not do me any good in the end.
__________________
Reply With Quote