Problem with Inner Join

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Anila
    New Member
    • May 2007
    • 12

    Problem with Inner Join

    Hi Friends,

    My problem with Inner join is ...

    first i joined two tables and i got the result.

    after that iam trying to join one more table its giving syn tax error in JOIN condition.

    Here is the Query

    [CODE=oracle]
    SELECT School.UPRN,
    School.SchoolNa me,
    School.DfeeNumb er,
    Count(Level4Ite m.Level4ItemKey ) AS CountOfLevel4It emKey
    FROM (School INNER JOIN Block ON School.SchoolKe y=Block.SchoolK ey) INNER JOIN Level4Item ON Block.BlockKey= Level4Item.Bloc kKey
    GROUP BY
    School.UPRN,
    School.SchoolNa me,
    School.DfeeNumb er,
    Block.BlockNumb er,
    School.Active,
    Level4Item.Acti ve
    HAVING (((Block.BlockN umber)<>"EXT")
    AND ((School.Active )=1)
    AND ((Level4Item.Ac tive)=1))
    ORDER BY
    Count(Level4Ite m.Level4ItemKey ) DESC;
    [/CODE]
    This is working.

    To this table i am trying to join one more. My problem is there are two tables called SCHOOL and SITE. SCHOOL table is having uprn, property name, sitekey and etc. and SITE table is having SiteKey, uprn, school name, AssetTypeKey Etc.....
    I took sitekey is primary key and try to join, but its giving Join error.

    The Query is

    [CODE=oracle]
    SELECT School.UPRN,
    School.SchoolNa me,
    School.DfeeNumb er,
    Count (Level4Item.Lev el4ItemKey) AS CountOfLevel4It emKey, Site.AssetTypeK ey
    FROM ((School INNER JOIN Block ON School.SchoolKe y = Block.SchoolKey ) INEER JOIN Site ON School.SiteKey = Site.SiteKey) INNER JOIN Level4Item ON Block.BlockKey = Level4Item.Bloc kKey
    GROUP BY
    School.
    UPRN,
    School.SchoolNa me,
    School.DfeeNumb er,
    Block.BlockNumb er,
    School.Active,
    Level4Item.Acti ve,
    School.SiteKey
    HAVING (((Block.BlockN umber)<>"EXT")
    AND ((School.Active )=1)
    AND ((Level4Item.Ac tive)=1))
    ORDER BY
    Count(Level4Ite m.Level4ItemKey ) DESC;[/CODE]

    Please help me.
    its urgent. iam not able to get this.

    thanks in advance.
    Last edited by debasisdas; Sep 5 '07, 09:09 AM. Reason: Formatted using code tags.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    As you have posted a question in the articles section, it is being moved to Oracle Forum

    MODERATOR.

    Comment

    • amitpatel66
      Recognized Expert Top Contributor
      • Mar 2007
      • 2358

      #3
      SELECT School.UPRN,
      School.SchoolNa me,
      School.DfeeNumb er,
      COUNT (Level4Item.Lev el4ItemKey) AS CountOfLevel4It emKey, Site.AssetTypeK ey
      FROM ((School INNER JOIN Block ON School.SchoolKe y = Block.SchoolKey ) INEER JOIN Site ON School.SiteKey = Site.SiteKey) INNER JOIN Level4Item ON Block.BlockKey = Level4Item.Bloc kKey
      GROUP BY
      School.
      UPRN,
      School.SchoolNa me,
      School.DfeeNumb er,
      Block.BlockNumb er,
      School.Active,
      Level4Item.Acti ve,
      School.SiteKey
      HAVING (((Block.BlockN umber)<>"EXT")
      AND ((School.Active )=1)
      AND ((Level4Item.Ac tive)=1))
      ORDER BY
      COUNT(Level4Ite m.Level4ItemKey ) DESC;
      There is a TYPO error in yur code. Instead of INNER u have used INEER.

      Comment

      • Anila
        New Member
        • May 2007
        • 12

        #4
        Originally posted by amitpatel66
        There is a TYPO error in yur code. Instead of INNER u have used INEER.

        Thank you. I got it.

        Comment

        Working...