multiple inner join error
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: multiple inner join error

  1. #1
    Join Date
    Apr 2009
    Posts
    2

    multiple inner join error

    Hi everyone, I am trying to do a query with 7 different tables by using the inner joint. When I run it it sais

    ERROR at line 15:
    ORA-00905: missing keyword

    Any ideas what it could be?

    HTML Code:
    SELECT 	FUNCTIONS.FUN_NAME, FUNCTIONS.FUN_ID, FUNCTIONS.FUN_NAME, 
    	EQUIPMENTS_FUNCTIONS.EQUIP_DESCRIPTION, HIRE_EQUIPMENTS.HEQUIP_DESCRIPTION,
    	STAFFS.EMP_TITTLE
    FROM	FUNCTIONS,EQUIPMENTS_FUNCTIONS,FUNCTIONS_HIRE_EQUIPMENTS,FUNCTIONS_STAFFS
    INNER JOIN 	
    	EQUIPMENTS_FUNCTIONS ON  FUNCTIONS.FUN_ID = EQUIPMENTS_FUNCTIONS.FUN_ID JOIN 
    INNER JOIN
    	EQUIPMENTS_FUNCTIONS ON EQUIPMENTS_ID.EQUIP_ID = EQUIPMENTS.EQUIP_ID
    INNER JOIN	
    	FUNCTIONS_HIRE_EQUIPMENTS ON FUNCTIONS.FUN_ID = FUNCTIONS_HIRE_EQUIPMENTS.FUN_ID
    INNER JOIN
    	FUNCTIONS_STAFFS ON FUNCTIONS.FUN_ID = FUNCTIONS_STAFFS.FUN_ID
    INNER JOIN
    	STAFFS ON FUNCTIONS_STAFFS.EMP_ID = STAFFS.EMP_ID 
    WHERE FUNCTIONS.FUN_ID = 'F20031235';

  2. #2
    Join Date
    Jul 2002
    Location
    Lake Worth, FL
    Posts
    1,441

    Cool Too many JOINs or too few SELECTs?

    You got two joins together:
    Code:
    -- Etc...
    INNER JOIN 	
    	EQUIPMENTS_FUNCTIONS ON  FUNCTIONS.FUN_ID = EQUIPMENTS_FUNCTIONS.FUN_ID JOIN 
    INNER JOIN
    -- Etc...
    "The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb

  3. #3
    Join Date
    Apr 2009
    Posts
    2

    Im getting mental!!

    I got rid of the extra join there, but it keeps giving me an error.

    ERROR at line 6:
    ORA-00904: "FUNCTIONS"."FUN_ID": invalid identifier

    Any idea in what is the best way to do this?

  4. #4
    Join Date
    Jul 2002
    Location
    Lake Worth, FL
    Posts
    1,441

    Talking desc MyTable

    Quote Originally Posted by virkof View Post
    I got rid of the extra join there, but it keeps giving me an error.

    ERROR at line 6:
    ORA-00904: "FUNCTIONS"."FUN_ID": invalid identifier

    Any idea in what is the best way to do this?
    Maybe use the correct column names that are defined in each table?
    "The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb

  5. #5
    Join Date
    Dec 2000
    Posts
    126

    try this

    SELECT FUNCTIONS.FUN_NAME, FUNCTIONS.FUN_ID, FUNCTIONS.FUN_NAME,
    EQUIPMENTS_FUNCTIONS.EQUIP_DESCRIPTION, HIRE_EQUIPMENTS.HEQUIP_DESCRIPTION,
    STAFFS.EMP_TITTLE
    FROM FUNCTIONS,EQUIPMENTS_FUNCTIONS,FUNCTIONS_HIRE_EQUIPMENTS,FUNCTIONS_STAFFS
    WHERE FUNCTIONS.FUN_ID = 'F20031235'
    and

    FUNCTIONS.FUN_ID = EQUIPMENTS_FUNCTIONS.FUN_ID
    and
    EQUIPMENTS_ID.EQUIP_ID = EQUIPMENTS.EQUIP_ID
    and
    FUNCTIONS.FUN_ID = FUNCTIONS_HIRE_EQUIPMENTS.FUN_ID
    and
    FUNCTIONS.FUN_ID = FUNCTIONS_STAFFS.FUN_ID
    and
    FUNCTIONS_STAFFS.EMP_ID = STAFFS.EMP_ID

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width