Skip to Content
author's profile photo Former Member
Former Member

How use Left Join in View

Hi All.

How can i using LEFT JOIN operation in View if it is possible?

Regard

Gennady Posevin

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Mar 06, 2007 at 10:46 AM

    Hi Gennady,

    I think by default views take the Inner Join. I think we can't give the joins explicitly while creating the joins.

    Regards,

    Ramesh Babu S

    *Correct me if I am Wrong

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 06, 2007 at 10:49 AM

    Hi,

    Left Join or the OUTER join is the same.

    See the sample example for outer /Left join:

    Join the columns carrid, carrname and connid of the database tables scarr and spfli using an outer join. The column connid is set to the null value for all flights that do not fly from p_cityfr. This null value is then converted to the appropriate initial value when it is transferred to the assigned data object. The LOOP returns all airlines that do not fly from p_cityfr.

    PARAMETERS p_cityfr TYPE spfli-cityfrom.

    DATA: BEGIN OF wa,

    carrid TYPE scarr-carrid,

    carrname TYPE scarr-carrname,

    connid TYPE spfli-connid,

    END OF wa,

    itab LIKE SORTED TABLE OF wa

    WITH NON-UNIQUE KEY carrid.

    SELECT scarrid scarrname p~connid

    INTO CORRESPONDING FIELDS OF TABLE itab

    FROM scarr AS s

    LEFT OUTER JOIN spfli AS p ON scarrid = pcarrid

    AND p~cityfrom = p_cityfr.

    LOOP AT itab INTO wa.

    IF wa-connid = '0000'.

    WRITE: / wa-carrid, wa-carrname.

    ENDIF.

    ENDLOOP.

    Regards,

    Anji

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 06, 2007 at 10:50 AM

    The outer join basically creates the same resulting set as the inner join, with the difference that at least one line is created in the resulting set for every selected line on the left-hand side, even if no line on the right-hand side fulfils the join_cond condition. The columns on the right-hand side that do not fulfil the join_cond condition are filled with null values.

    In outer join u cannot specify a condition on the right hand side table in where clause...

    PARAMETERS p_cityfr TYPE spfli-cityfrom.

    DATA: BEGIN OF wa,

    carrid TYPE scarr-carrid,

    carrname TYPE scarr-carrname,

    connid TYPE spfli-connid,

    END OF wa,

    itab LIKE SORTED TABLE OF wa

    WITH NON-UNIQUE KEY carrid.

    SELECT scarrid scarrname p~connid

    INTO CORRESPONDING FIELDS OF TABLE itab

    FROM scarr AS s

    LEFT OUTER JOIN spfli AS p ON scarrid = pcarrid

    AND p~cityfrom = p_cityfr.

    LOOP AT itab INTO wa.

    IF wa-connid = '0000'.

    WRITE: / wa-carrid, wa-carrname.

    ENDIF.

    ENDLOOP.

    reward if it helps u...

    sai ramesh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 06, 2007 at 11:30 AM

    While creating the database view , one cannot specify the left outer join seperately..

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.