Hi Keith,
I think your problem comes down to the fact that IF() is a function
that must return one value, when you put in your '*' you might be
specifying more then one value to return.
/Johan
Keith wrote:
g'day,
Am having a bit of a problem with using IF. This is the error message I get:
-----
SELECT rac.name AS race,
IF (
el.entityType =1, ch. * , npc. *
)charData
FROM characters AS ch, entityLocation AS el, races AS rac, npc AS npc
WHERE el.entityType
IN ( 1, 10 ) AND el.containerType =6 AND el.containerID =75402 AND
IF (
el.entityType =1, el.entityID = ch.characterID AND el.visibility <=60 AND
ch.raceID = rac.raceID AND ch.handle <> 'Khan', el.entityID = npc.npcID AND
el.visibility <=60 AND npc.raceID = rac.raceID
)
LIMIT 0 , 30
MySQL said:
#1064 - You have an error in your SQL syntax. Check the manual that
corresponds to your MySQL server version for the right syntax to use near '*
, npc. * )charData
FROM characters AS ch, entityLocation AS
-----
What I want to do is select everything from characters if the el.entityType
is 1, else I want to select everything from npc table.
Cheers,
Keith
--
Johan Höök, Pythagoras Engineering Group
- MailTo:[EMAIL PROTECTED]
- http://www.pythagoras.se
Pythagoras AB, Stormbyv. 2-4, SE-163 55 SPÅNGA, Sweden
Phone: +46 8 760 00 10 Fax: +46 8 761 22 77
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]