Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2004
    Posts
    13

    Unanswered: Server: Msg 107, Level 16, State 2, Line 1

    Can anybody help me with this syntax?
    select
    PHN.N_PHN_ID 'ID',
    PHN.N_PHN_AREACD 'AREAD1',
    PHN.N_PHN_PREFIX 'PREFIXD1',
    PHN.N_PHN_NUMBER 'NBRD1',
    PHN.N_PHN_EXTENTN 'EXTD1',
    PHN2.N_PHN_AREACD 'AREAD2',
    PHN2.N_PHN_PREFIX 'PREFIXD2',
    PHN2.N_PHN_NUMBER 'NBRD2',
    PHN2.N_PHN_EXTENTN 'EXTD2'
    from Donor_Visit2 DV2 RIGHT OUTER JOIN NAT_PHN_DB_REC PHN
    ON DV2.COUNT_INSTID = PHN.N_PHN_INSTID
    RIGHT OUTER JOIN NAT_PHN_DB_REC PHN2
    ON DV2.COUNT_ID = PHN2.PHN.N_PHN_ID
    order by PHN.N_PHN_ID

    here is the error message:
    Server: Msg 107, Level 16, State 2, Line 1
    The column prefix 'PHN2.PHN' does not match with a table name or alias name used in the query.

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    The error messages don't always tell you the right thing...sometime it gets confused..


    Code:
        SELECT PHN.N_PHN_ID 	AS ID
    	 , PHN.N_PHN_AREACD 	AS AREAD1
    	 , PHN.N_PHN_PREFIX 	AS PREFIXD1
    	 , PHN.N_PHN_NUMBER 	AS NBRD1
    	 , PHN.N_PHN_EXTENTN 	AS EXTD1
    	 , PHN2.N_PHN_AREACD 	AS AREAD2
    	 , PHN2.N_PHN_PREFIX 	AS PREFIXD2
    	 , PHN2.N_PHN_NUMBER 	AS NBRD2
    	 , PHN2.N_PHN_EXTENTN 	AS EXTD2
          FROM Donor_Visit2 DV2 
    RIGHT JOIN NAT_PHN_DB_REC PHN
    	ON DV2.COUNT_INSTID = PHN.N_PHN_INSTID
    RIGHT JOIN NAT_PHN_DB_REC PHN2
    	ON DV2.COUNT_ID     = PHN2.PHN.N_PHN_ID
      ORDER BY PHN.N_PHN_ID
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

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