> Luc Foisy wrote: > > >Since the below select query blew up on me, then I must be > doing something wrong, perhaps it is because I am using the > wrong type of join, dunno > >I would like to join the same table twice, with different > criteria as below > > > >Anyone got a solution to this? > > > >SELECT EVENTATTENDANCE.ID, > > CONCAT(IF(SALUTATION.Name IS NOT > NULL,CONCAT(SALUTATION.Name,' '),''),IF(FirstName IS NOT > NULL, FirstName, ''),' ', IF(LastName IS NO > >T NULL, LastName, '')) AS 'Contact' , > > ORGANIZATION.Name AS 'Organization', > > RELATIONSHIP.Name AS 'Relationship', > > STATUS.Description AS 'Status' > >FROM EVENTATTENDANCE > >LEFT JOIN EVENT ON EVENTATTENDANCE.ID_EVENT = EVENT.ID > >LEFT JOIN CONTACT ON EVENTATTENDANCE.ID_CONTACT = CONTACT.ID > >LEFT JOIN STATUS ON EVENTATTENDANCE.ID_STATUS = STATUS.ID > >LEFT JOIN ORGANIZATION ON CONTACT.ID_ORGANIZATION = ORGANIZATION.ID > >LEFT JOIN TYPE RELATIONSHIP ON CONTACT.ID_TYPE_RELATIONSHIP > = TYPE.ID > >LEFT JOIN TYPE SALUTATION ON CONTACT.ID_TYPE_SALUTATION = TYPE.ID > >WHERE EVENTATTENDANCE.ID_EVENT = -1 > >ORDER BY CONTACT.FirstName > >SQL Error in populateDataSet > >============================== > >Please Restart The Application > >============================== > >SQLException: General error: Unknown table 'TYPE' in on clause > >
> > Your Table is named TYPE? Bad idea, because it is a reserved > word in all > SQL dialects I know of. try 'TYPE' instead of TYPE, but I really > recommend to rename that table...You'll run into trouble all the time > and all coders/developers who'll work with that DB will hate you for > eternity ;-) TYPE is not a reserved word. We have used TYPE for the last 2 years, created several databases with that table name, used it many times in many many places. MySQL has not complained once before now. And TYPE is not here http://www.mysql.com/doc/R/e/Reserved_words.html That can't be the problem, it has to be something with the joins. --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php