sesmar
06-25-2006, 03:58 AM
Does anyone else have trouble running what seems to be simple queries in MySql?
I going through and trying to clean up some stuff in the datbase. Particularly faction tables right now. My Problem is that any of the queries that I want to run to give me the information I need just lock up my server. These queries are really simple and should not have this effect esp when I am able to run what seems to be more complicated queries.
For example:
SELECT
npc_faction_id,
npc_faction.name
FROM
npc_types
INNER JOIN spawnentry
ON npcID=npc_types.id
INNER JOIN spawn2
ON spawnentry.spawngroupID=spawn2.spawngroupID
INNER JOIN npc_faction
ON npc_faction.id=npc_types.npc_faction_id
WHERE
spawn2.zone='qeynos'
GROUP BY
npc_faction_id,
npc_faction.name
This query will run with out a problem at all. but if I try and run this:
SELECT
npc_faction.id,
npc_faction.name
FROM
npc_faction
LEFT JOIN npc_types
ON npc_types.npc_faction_id=npc_faction.id
WHERE
npc_types.id IS NULL
It will lock up my server.
But I can run this query which is the same type of concept:
SELECT
id,
name
FROM
faction_list
LEFT JOIN npc_faction_entries
ON faction_id=id AND npc_faction_id = 2613
WHERE
npc_faction_id IS NULL
ORDER BY
name
I have tried doing some searching on the internet but can not find anything as to the cause of this. I have tried this on MySql 4 and 5 and have had problem with other queries as well. Usually they have something to do with LEFT or RIGHT JOINS looking for NULL values. Any information on this would be appreciated
I going through and trying to clean up some stuff in the datbase. Particularly faction tables right now. My Problem is that any of the queries that I want to run to give me the information I need just lock up my server. These queries are really simple and should not have this effect esp when I am able to run what seems to be more complicated queries.
For example:
SELECT
npc_faction_id,
npc_faction.name
FROM
npc_types
INNER JOIN spawnentry
ON npcID=npc_types.id
INNER JOIN spawn2
ON spawnentry.spawngroupID=spawn2.spawngroupID
INNER JOIN npc_faction
ON npc_faction.id=npc_types.npc_faction_id
WHERE
spawn2.zone='qeynos'
GROUP BY
npc_faction_id,
npc_faction.name
This query will run with out a problem at all. but if I try and run this:
SELECT
npc_faction.id,
npc_faction.name
FROM
npc_faction
LEFT JOIN npc_types
ON npc_types.npc_faction_id=npc_faction.id
WHERE
npc_types.id IS NULL
It will lock up my server.
But I can run this query which is the same type of concept:
SELECT
id,
name
FROM
faction_list
LEFT JOIN npc_faction_entries
ON faction_id=id AND npc_faction_id = 2613
WHERE
npc_faction_id IS NULL
ORDER BY
name
I have tried doing some searching on the internet but can not find anything as to the cause of this. I have tried this on MySql 4 and 5 and have had problem with other queries as well. Usually they have something to do with LEFT or RIGHT JOINS looking for NULL values. Any information on this would be appreciated