1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

error in line 1 select *

Discussion in 'SQL PL/SQL' started by monkey, Jun 9, 2014.

  1. monkey

    monkey Long Term Member

    Messages:
    156
    Likes Received:
    0
    Trophy Points:
    230
    Code (SQL):
    SELECT *
    FROM o
    FULL OUTER JOIN op
    ON o.id_o=op.id_op
    WHERE o.o_id=op.id_op;
    Please, wjho sees the mistake?
    many thanks!!!
     
  2. monkey

    monkey Long Term Member

    Messages:
    156
    Likes Received:
    0
    Trophy Points:
    230
    Please, don+t see the possible error!

    o= visitor

    p= film production

    op = inbetween entity
    There are more visitors to one film production.
    I need to count number of visitors per film production.

    Really do not see the error
     
  3. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,351
    Likes Received:
    348
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    That's not the entire error text; post the rest of it, please. Also post table definitions and sample data for the o and op tables.
     
  4. krasnoslobodtsev_si

    krasnoslobodtsev_si Forum Genius

    Messages:
    626
    Likes Received:
    129
    Trophy Points:
    810
    Location:
    Russian Federation
    Hi.

    See link : JOINS
    Code (SQL):


    SELECT *
    FROM o
    FULL JOIN op ON o.id_o=op.id_op;

    --WHERE o.o_id=op.id_op; --This condition is superfluous.
    --if to use a this postcondition, then for your case it is better to use Equijoins
     

    For example :

    Code (SQL):
    -- This condition is superfluous.
    WITH
    tab1 AS
    (SELECT 1 id FROM dual UNION ALL
     SELECT 3    FROM dual
     ),
    tab2 AS
    (SELECT 2 id FROM dual  UNION ALL
     SELECT 1    FROM dual
    )


    SELECT * FROM tab1
    FULL JOIN  tab2 ON tab2.id = tab1.id
    WHERE tab2.id = tab1.id;

     

    --- >
    Code (SQL):

    WITH
    tab1 AS
    (SELECT 1 id FROM dual UNION ALL
     SELECT 3    FROM dual
     ),
    tab2 AS
    (SELECT 2 id FROM dual  UNION ALL
     SELECT 1    FROM dual
    )


    SELECT * FROM tab1
    oin  tab2 ON tab2.id = tab1.id;




     
    Note :