How to do an INNER JOIN sub-query?

Can't seem to find anything that would help me out with this.
My prototype query goes like this but its giving me a ORA-00905: missing keyword
SELECT Poker_Site.site_name, bonus.sign_up_bonus
     FROM poker_site
     INNER JOIN bonus
     WHERE Poker_site.site_name = 'Poker Stars'
     ON Poker_Site.site_name = bonus.site_name;

INNER JOIN join must be immediately followed by ON and only then by WHERE:
SELECT Poker_Site.site_name, bonus.sign_up_bonus
FROM poker_site
INNER JOIN bonus
ON Poker_Site.site_name = bonus.site_name
WHERE Poker_site.site_name = 'Poker Stars';SY.

Similar Messages

  • How to avoid or replace a sub query from Exists statement.

    Hello all,
    I have a query regarding sql query.
    DB 1
    Table A                                 Table B
    ID   Code   HeaderID            ID   
    1    100      1                          1
    2    200      1                          2
    3    100      2                          3
    DB 2
    Table C
    ID    Code  Type
    1     100     1
    2     101     1
    3     100     2
    set @HeaderID = 1
    IF EXISTS (SELECT Code From Table A WHERE HeaderID=@ID AND Code  not in (SELECT Code FROM Table C WHERE Type=1))
    BEGIN
    RAISERROR('code is not set.',16,1)
    END
    Table A and Table C are in different databases say DB1 and DB2.
    How can we replace this with another query using join or something. Can we do it using one query by avoiding sub query.I want to get Code 200 which is not match with Table C Code.
    Regards, Ranjith T Rajan Acty System India Pvt Ltd.

    Instead of checking later and raising an error you can create a check constraint on the table so that it raises error when you insert the non existent code itself.
    You can create a UDF like below
    CREATE FUNCTION CheckCodeExistence
    @Code int,
    @HeaderID int
    RETURNS bit
    AS
    BEGIN
    DECLARE @Ret bit
    SELECT @Ret = CASE WHEN NOT EXISTS (SELECT 1
    FROM DB2.dbo.TableC
    WHERE Code = @code
    AND [TYPE] = @headerID)
    THEN 0
    ELSE 1 END
    RETURN(@ret)
    END
    Then create a check constraint on Table A based on it as
    ALTER TABLE TableA ADD CONSTRAINT Chk_TableA CHECK (dbo.CheckCodeExistence(Code,HeaderID) =1 )
    Now when you try to insert record with Code 200 you'll get the below
    Msg 547, Level 16, State 0, Line 1
    The INSERT statement conflicted with the CHECK constraint "Chk_TableA". The conflict occurred in database "DB1", table "dbo.TableA".
    The statement has been terminated.
    See similar example here
    http://visakhm.blogspot.in/2012/05/implementing-multiple-table-based-check.html
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Inner Join Select query

    hello all,
    Below is a inner join query
        SELECT aebeln aebelp apackno bzekkn b~ps_psp_pnr
                     FROM ( ( ekpo AS a INNER JOIN ekkn AS b
                              ON aebeln = bebeln
                              AND  aebelp = bebelp )
                             INNER JOIN prps AS c
                              ON bps_psp_pnr = cpspnr )
                     INTO TABLE t_wbspo
                      WHERE a~ebeln IN s_ebeln
                       AND  c~psphi IN s_psphi
                       AND  stufe = c_task.
    I want to modify this select and put one more join on ekkn-aufnr
    and aufk-afunr .
    Now for this i write the below code
      SELECT aebeln aebelp apackno bzekkn bps_psp_pnr baufnr
               FROM ( ( ( ekpo AS a INNER JOIN ekkn AS b
                        ON aebeln = bebeln
                        AND  aebelp = bebelp )
                       INNER JOIN prps AS c
                        ON bps_psp_pnr = cpspnr )
                        INNER JOIN aufk AS d
                        ON baufnr = daufnr )
               INTO TABLE t_wbspo
                WHERE a~ebeln IN s_ebeln
                 AND  c~psphi IN s_psphi
                 AND  d~aufnr IN s_aufnr
        AND  stufe = c_task.
    By the above way does it puts a join on ekkn-aufnr and aufk-aufnr ?
    Is the above way the right way to do it ?
    Please confirm
    regards

    Hello Bhanu,
    Do you face any performance issue? Query looks good now, further you can refer to following threads to know more on JOIN-
    Re: Inner join
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ec77446011d189700000e8322d00/frameset.htm
    Thank You,
    Nishikant Kumbhar.

  • CSOM (Javascript) Inner join CAML query on 'User Information List'

    I need to pull site user details like (email, display name, phone) from 'User information list' using a 'inner join' on a different list 'SiteOwners' where 'Contact' is a person or group field.
    The result object is not returning the details from 'User Information List' though it returns details from 'SiteOwners' list
    <script src="/_layouts/15/SP.runtime.js" type="text/javascript"></script>
    <script src="/_layouts/15/SP.js" type="text/javascript"></script>
    <script type='text/javascript'>
    'use strict';
    //$(document).ready(function() {
    function abc() {
    var context = SP.ClientContext.get_current();
    var web =context.get_web();
    var stownrlist = web.get_lists().getByTitle('SiteOwners');
    var camlqry = new SP.CamlQuery();
    camlqry.set_viewXml = "<View>" +
    "<Query></Query>" +
    "<ViewFields>" +
    "<FieldRef Name='Title'/>" +
    "<FieldRef Name='Contact'/>" +
    "<FieldRef Name='UserName'/>" +
    "<FieldRef Name='UserEMail'/>" +
    "<FieldRef Name='UserMobilePhone'/>" +
    "</ViewFields>" +
    "<ProjectedFields>" +
    "<Field Name='UserName' Type='Lookup' List='User Information List' ShowField='Name' />" +
    "<Field Name='UserEMail' Type='Lookup' List='User Information List' ShowField='EMail' />" +
    "<Field Name='UserMobilePhone' Type='Lookup' List='User Information List' ShowField='MobilePhone' />" +
    "</ProjectedFields>" +
    "<Joins>" +
    "<Join Type='INNER' ListAlias='User Information List'>" +
    "<Eq>" +
    "<FieldRef Name='Contact' RefType='Id'/>" +
    "<FieldRef List='User Information List' Name='ID'/>" +
    "</Eq>" +
    "</Join>" +
    "</Joins>" +
    "</View>";
    debugger;
    var stownritems = stownrlist.getItems(camlqry);
    context.load(stownritems);//, 'Include(Title,Contact,UserName,UserEMail,UserMobilePhone)');
    context.executeQueryAsync(
    Function.createDelegate(this, function () {
    debugger;
    var stownenm = stownritems.getEnumerator();
    while (stownenm.moveNext()) {
    var userid, loginname,email,name,mobilephone;
    if (stownenm.get_current().get_item('Contact') != null) {
    userid = stownenm.get_current().get_item('Contact').get_lookupId();
    loginname = stownenm.get_current().get_item('Contact').get_lookupValue();
    email = stownenm.get_current().get_item('ows_UserEMail');
    name = stownenm.get_current().get_item('UserName');
    mobilephone = stownenm.get_current().get_item('UserMobilePhone');
    }), function() {alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());});
    </script>
    Any suggestions / help please.
    Sai

    I identified the issue
    "camlqry.set_viewXml"  is a method (camlqry.set_viewXml()) not a property (as apposed to C#).
    The above should be like "camlqry.set_viewXml(querystring)" instead of "camlqry.set_viewXml =qrystring".
    Sai

  • How to specify an outer join in query builder

    I've very quickly built a large query with the query builder, and it works fine, but only produces 9 out of 2200 records - so I need to change it to an outer join.
    My problem is that I can't seem to find a way to specify an outer join. I've tried editing the query that query builder formed, but it won't let me.
    I know I can capture the query, edit it and run it in sql developer, and that works fine, but I want to use query builder as it is the fastest way I know of to quickly add and remove items - my users are unsure of exactly what to include.
    I know it is kind of a trivial question, but i've searched the forum, the manual, the web and no luck
    Thanks for any help you can give
    Glenn

    Hi Glenn,
    When you use the Query Builder to create the sql statement, you should click on the empty square to the right of the fields on each table to create the join. When you've done this, you should see a line drawn between the two tables. Click on this line and a small popup appears allowing you to select inner, left outer or right outer joins.
    Once the report has been created, though, you need to edit the statement. For example, if you use the Query Builder to join DEPT to EMP based on the DEPTNO field on both tables, you get:
    select      "DEPT"."DEPTNO" as "DEPTNO",
          "DEPT"."DNAME" as "DNAME",
          "DEPT"."LOC" as "LOC",
          "EMP"."EMPNO" as "EMPNO",
          "EMP"."ENAME" as "ENAME",
          "EMP"."JOB" as "JOB",
          "EMP"."MGR" as "MGR",
          "EMP"."HIREDATE" as "HIREDATE"
    from      "EMP" "EMP",
          "DEPT" "DEPT"
    where   "DEPT"."DEPTNO"="EMP"."DEPTNO"Change this to:
    select      "DEPT"."DEPTNO" as "DEPTNO",
          "DEPT"."DNAME" as "DNAME",
          "DEPT"."LOC" as "LOC",
          "EMP"."EMPNO" as "EMPNO",
          "EMP"."ENAME" as "ENAME",
          "EMP"."JOB" as "JOB",
          "EMP"."MGR" as "MGR",
          "EMP"."HIREDATE" as "HIREDATE"
    from      "EMP" "EMP"
          LEFT OUTER JOIN "DEPT" "DEPT" ON "DEPT"."DEPTNO"="EMP"."DEPTNO"Andy

  • How to remove duplicates while joining two query results ?

    Hi all,
    Please, anyone suggest me how to do below one.. i am using oracle version 11.2.0.3.0
    Col_1 Col_2
    111 AAA
    AAA 111
    222 BBB
    333 CCC
    As, oracle point of view the above table contains distinct rows. But i need the logic result like below,
    Col_1 Col_2
    111 AAA
    222 BBB
    333 CCC

    And if columns are NULLable:
    with sample_table as (
                          select '111' col1,'AAA' col2 from dual union all
                          select 'AAA','111' from dual union all
                          select '222','BBB' from dual union all
                          select '333','CCC' from dual union all
                          select '444',to_char(null) from dual union all
                          select to_char(null),'444' from dual union all
                          select to_char(null),to_char(null) from dual union all
                          select to_char(null),to_char(null) from dual
    select  least(col1,col2) col1,
            case
              when col1 is null then col2
              when col2 is null then col1
              else greatest(col1,col2)
            end
      from  sample_table s
      group by least(col1,col2),
               case
                 when col1 is null then col2
                 when col2 is null then col1
                 else greatest(col1,col2)
               end
      order by least(s.col1,s.col2),
               case
                 when s.col1 is null then s.col2
                 when s.col2 is null then s.col1
                 else greatest(s.col1,s.col2)
               end
    COL CAS
    111 AAA
    222 BBB
    333 CCC
        444
    SQL>  SY.

  • Self join sub query help

    This is my table
    Doctor     Appointment Date     Rating
    111     23/12/2009     G1
    111     23/12/2009     G2
    111     23/12/2009     B
    111          23/12/2009 D
    111     23/12/2008     G1
    111          23/12/2008 B
    111     23/12/2007     G2
    111          23/12/2007 B
    111     23/12/2006     D
    For Doctor 111, on a given appointment date he has multiple ratings.
    I have to fetch the rows (with doctor id, appointment date)
    I) which does not have G1 rating but has G2 rating for each appointment date
    And vice versa ( does not have G2 rating but has G1 rating for each appointment date)
    And
    II) if the particular appointment date has both G1 and G2 rating then I can ignore that appointment date – i.e do not fetch any rows if that appointment date has both G1 and G2 ratings.
    And
    III)     if the appointment date has no G1 or G2 rating, then display the appointment date and the doctor.
    So, my result set should have the output from all the three conditions for each doctor.
    I am not sure how it works. I am trying using correlated subqueries any suggestions???

    ME_XE?with data as
      2  (
      3     select 111 as doc_id, to_date('23/12/2009', 'dd/mm/yyyy') as app_date, 'G1'   as app_type from dual union all
      4     select 111 as doc_id, to_date('23/12/2009', 'dd/mm/yyyy') as app_date, 'G2'   as app_type from dual union all
      5     select 111 as doc_id, to_date('23/12/2009', 'dd/mm/yyyy') as app_date, 'B'    as app_type from dual union all
      6     select 111 as doc_id, to_date('23/12/2009', 'dd/mm/yyyy') as app_date, 'D'    as app_type from dual union all
      7     select 111 as doc_id, to_date('23/12/2008', 'dd/mm/yyyy') as app_date, 'G1'   as app_type from dual union all
      8     select 111 as doc_id, to_date('23/12/2008', 'dd/mm/yyyy') as app_date, 'B'    as app_type from dual union all
      9     select 111 as doc_id, to_date('23/12/2007', 'dd/mm/yyyy') as app_date, 'G2'   as app_type from dual union all
    10     select 111 as doc_id, to_date('23/12/2007', 'dd/mm/yyyy') as app_date, 'B'    as app_type from dual union all
    11     select 111 as doc_id, to_date('23/12/2006', 'dd/mm/yyyy') as app_date, 'D'    as app_type from dual
    12  )
    13  select
    14     doc_id,
    15     app_date,
    16     app_type
    17  from
    18  (
    19     select
    20        sum( case when app_type = 'G1' then 1 else 0 end ) over (partition by doc_id, app_date) as g1,
    21        sum( case when app_type = 'G2' then 1 else 0 end ) over (partition by doc_id, app_date) as g2,
    22        doc_id,
    23        app_date,
    24        app_type
    25     from data
    26  )
    27  where g1 = 0 and g2 = 0
    28  or
    29  (
    30     g1 > 0 and g2 = 0
    31  )
    32  or
    33  (
    34     g2 > 0 and g1 = 0
    35  );
                DOC_ID APP_DATE                   APP_TY
                   111 23-DEC-2006 12 00:00       D
                   111 23-DEC-2007 12 00:00       B
                   111 23-DEC-2007 12 00:00       G2
                   111 23-DEC-2008 12 00:00       G1
                   111 23-DEC-2008 12 00:00       B
    5 rows selected.
    Elapsed: 00:00:00.59
    ME_XE?
    ME_XE?select * from v$version;
    BANNER
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    5 rows selected.
    Elapsed: 00:00:00.64Is one method using analytics (which allow you to perform operations over a 'window' of data, which seems to be what you need to do).

  • Hi! Everyone, I have some problems with JOIN and Sub-query; Could you help me, Please?

    Dear Sir/Madam
    I'm a student who is interested in Oracle Database and
    I have some problems with JOIN and Sub-query.
    I hope so many of you could help me.
    if i use JOIN without sub-query, may it be faster or not?
    SELECT field1, field2 FROM tableA INNER JOIN tableB
    if i use JOIN with sub-query, may it be faster or not?
    SELECT field1,field2,field3 FROM tableA INNER JOIN (SELECT field1,field2 FROM tableB)
    Thanks in advance!

    Hi,
    fac30d8e-74d3-42aa-b643-e30a3780e00f wrote:
    Dear Sir/Madam
    I'm a student who is interested in Oracle Database and
    I have some problems with JOIN and Sub-query.
    I hope so many of you could help me.
    if i use JOIN without sub-query, may it be faster or not?
    SELECT field1, field2 FROM tableA INNER JOIN tableB
    if i use JOIN with sub-query, may it be faster or not?
    SELECT field1,field2,field3 FROM tableA INNER JOIN (SELECT field1,field2 FROM tableB)
    Thanks in advance!
    As the others have said, the execution plan will give you a better idea about which is faster.
    If you're trying to see how using (or not using) a sub-query affects performance, make the rest of the queries as similar as possible.  For example, include field3 in both queries, or ignore field3 in both queries.
    In this particular case, I guess the optimizer would do the same thing either way, but that's just a guess.  I can't see your execution plans.
    In general, simpler code is faster, and better in other ways, too.  In this case
    tableB
    is simpler than
    (SELECT field1, field2  FROM tableB)
    Why do you want a sub-query in this example?

  • Help: Modifying inner join

    Hello Folks,
    I have an Access Query and am rewriting the whole query in Oracle to run a report.The thing is Am a beginner in oracle and am scratching my head on how to modify this inner join. please help me in rewriting this inner join in oracle. thanks a million
       ((Debtor INNER JOIN MAX_TRANS_DATE AS MAX_TRANS_DATE_1 ON Debtor .
            EVENT_ID = MAX_TRANS_DATE_1.EVENT_ID) INNER JOIN
            TMP$ALL_RECOVERY_TYPE
            ON(Debtor . EVENT_CASE_ID = TMP$ALL_RECOVERY_TYPE . EVENT_CASE_ID) AND
            (Debtor . EVENT_ID = TMP$ALL_RECOVERY_TYPE . EVENT_ID))
    INNER JOIN CUBS TRANSACTIONS
        ON (Debtor . EVENT_ID = CUBS TRANSACTIONS . EVENT_ID)
       AND (Debtor . EVENT_CASE_ID = CUBS TRANSACTIONS . EVENT_CASE_ID)

    Thanks for getting back. But still am unable to get the correct data. I will try to break it down.
    Microsoft Access Table MAX_TRANS_DATE menitoned above in the inner join was originally coming from table called TRANSACTIONS i.e.( MAX_TRANS_DATE = SELECT [Transactions].[EVENT_ID], Max([Transactions].[TRANSDATE]) AS MaxOfTRANSDATE
    FROM Debtor INNER JOIN Transactions ON [Debtor].[EVENT_ID]=[Transactions].[EVENT_ID]
    GROUP BY [Transactions].[EVENT_ID];
    Here the problem is am recreating the access database query in oracle database and we dont have MAX_TRANS_DATE in the Oracle database but we do have TRANSACTIONS table.
    So i just used TRANSACTIONS in the inner join instead of MAX_TRANS_DATE.
    But the result is wrong.The Field Transdate from TRANSACTIONS is pulling dates as 10/5/2006 instead of 02/01/2010. I suspect something is wrong with the joins.Please help me. I can provide the old access query and the new oracle query that i have created.
    Thanks
    Edited by: user11961230 on Mar 5, 2010 11:49 AM

  • Inner join on bkpf and bsid

    Hi Experts ,
    I want to do an inner join on bsid and bkpf tables in the select query . I want to order the result on the basis of cputm field in bkpf , that is why inner join on bkpf is req , rest all the fields are from bsid . But the requirement  is that we should not select the cputm field in the select , it is only to be used for sorting the result of the select query . we are also using select * from bsid where ......  endselect . and not specific fields from bsid currently . Kindly let me know how to use the inner join on bkpf and bsid in this case .
    Would reward all helpful answers .
    Thanks

    Hi Ankit,
    First make a structure of the required fields.
    TABLES : bkpf,bsid.
    TYPES : BEGIN OF x_tab,
              belnr like bkpf-belnr,
              kunnr like bsid-kunnr,
              bldat like bsid-bldat,
              budat like bsid-budat,
              waers like bsid-waers,
          END OF x_tab.
    DATA :  itab type STANDARD TABLE OF x_tab,
            wa_itab TYPE x_tab.
    start-of-SELECTION.
    SELECT bkpfbelnr bsidkunnr bsidbldat bsidbudat bsid~waers into table itab
       FROM bkpf INNER JOIN bsid on bkpfbelnr = bsidbelnr and
                                    bkpfbukrs = bsidbukrs and
                                    bkpfgjahr = bsidgjahr.
    Rewards Points, if useful.
    Regards
    Manoj Kumar
    Edited by: Manoj Kumar on Dec 26, 2007 2:36 PM

  • Re field order in INNER JOIN

    Hi,
    I need a suggestion for improvement of my inner JOIN statement.
    internal table itab is of below type
    type: begin of ty_itab
            field a
            field b
            field c
            field d
            end of ty_itab
    I have to join two database table TABLE1 and TABLE2. Fields a and d are from TABLE2 and fields b and c are from TABLE 1.
    But in the internal table I must have the fields in the order fielda,b,c,d.
    Which of the below two options will be better for performance ? And why ?
    option 1:
    SELECT tab2~a
                  tab1~b
                  tab1~c
                  tab2~d into corresponding fields of itab from TABLE1 as tab1 and TABLE2 as tab2 on..........
    option2:
    SELECT tab1~b
                  tab1~c
                  tab2~a 
                  tab2~d into corresponding fields of itab from TABLE1 as tab1 and TABLE2 as tab2 on..........
    Thanks in advance...
    Best Regards
    Ananya Mukherjee
    Moderator message - Cross post locked
    Edited by: Rob Burbank on May 28, 2009 9:43 AM

    I am not satisfied with your two options. Because of following reason,
    1. First I want to know which one is master table and item table. Because in inner join select query you want to use master table as first and you want to use the item table as second.
    Example: 
    SELECT TAB2A  TAB1B TAB1C TAB2D
          INTO TABLE ITAB
        FROM <MASTER TABLE1> AS TAB1 INNER JOIN <ITEM TABLE2> AS TAB2 ON..........
    2. You should not use the INTO CORRESPONDING FIELDS OF ITAB. Instead of this you can change the field order in internal table or in select query.
    Example:
    Use following way
    TYPE: BEGIN OF TY_ITAB
                    FIELD A
                    FIELD B
                    FIELD C
                    FIELD D
               END OF TY_ITAB
    SELECT TAB2A  TAB1B TAB1C TAB2D
         INTO TABLE ITAB
       FROM <MASTER TABLE1> AS TAB1 INNER JOIN <ITEM TABLE2> AS TAB2 ON..........
    Or , Anyway you are going to use in program only. It will not affect your logic if change the field order in the internal table.
    TYPE: BEGIN OF TY_ITAB
                    FIELD B
                    FIELD C
                    FIELD A
                    FIELD D
              END OF TY_ITAB
    SELECT TAB1B  TAB1C  TAB2A  TAB2D
         INTO TABLE ITAB
       FROM <MASTER TABLE1> AS TAB1 INNER JOIN <ITEM TABLE2> AS TAB2 ON..........
    3. In inner join query, the order of Where condition also create the perform issue. Because in where condition maximum you try to use all the primary key from <MASTER TABLE1>  and <ITEM TABLE2> and field order in where condition should be same order in <MASTER TABLE1>  and  <ITEM TABLE>.
    This are the things you want to take care when you try to use INNER JOIN Query. If you have any clarification please let me know. I will try answer your Questions.
    Ravi.
    Edited by: RavivarmanP on May 28, 2009 6:55 PM

  • Can I di Inner Join on 2 tables by using only 1 key field?

    Hello,
    I hv 2 Std. SAP tables, KNVV, KNKK.
    - KNVV - does hv 2 key fields (KUNNR and some other, say X)
    - KNKK - does hv 2 key fields (KUNNR and some other,say Y)
    I want to build a inner join on these 2 tables.
    So, Can I do a INNER JOIN on these 2 tables by using ONLY one key field (its KUNNR)? bcoz, there is ONLY common field!!
    thank you

    Hi,
    The correctness depends on your bussiness requirement. If the common key field is not a primary key, you may end up fetching duplicate entries which you may have to delete after the select query. You dont have to take of any extra precautions in a inner join select query compared to a ordinary select query. Just make sure you use most of the primary key fields of both the tables  in the where clause of the select query for better performance
    Vikranth

  • Performance considerations between a cross join and inner join

    Hi there,
    What's the performance difference and impact on running a cross-join based query against an inner join based query?
    Regards and thanks

    Before going to the performance issue - ensure you get the required data and not just some data shown.
    Performance should be checked only between equivalent queries which produce same output but with different processing.
    Are you sure you get same output in cross join as well as inner join?
    If so pass on your different queries and then discuss with one is better.

  • Inner join to get the mail id

    HI All,
    I have to get the email id by linking the following table.
    EKKO get vender number
    from LFA1 table get address ADRNR
    FROM ADR6 get the email id.
    how can i user inner join to achive the condition?
    Thanks in advance.

    Hi,
    Syntax errors are corrected here:
    tables: ekko, lfa1, adr6.
    data: l_lifnr like ekko-lifnr,
          l_adrnr like lfa1-adrnr,
          l_smtp_addr like adr6-smtp_addr.
    SELECT ekko~lifnr
             lfa1~adrnr
             adr6~smtp_addr
             into (l_lifnr, l_adrnr, l_smtp_addr)
             from ( ( ekko inner join lfa1 as lfa1 on ekko~lifnr = lfa1~lifnr )
                           inner join adr6 as adr6 on lfa1~adrnr = adr6~addrnumber ).
    write:/ l_lifnr, l_adrnr, l_smtp_addr.
    ENDSELECT.
    Hope it works
    thanks\
    Mahesh

  • How to get all rows that are returned in inner sub query of select statemen

    If a sub query in select statement returns more than one row than how to get all those returned rows in the final
    output of the query .It will be all right if all column's value repeat and that multiple output of inner query comes
    in another column .
    How to get that ?

    As Frank said, you likely want a join, and likely an outer join to replicate the select in the projection. Something like:
    SELECT id,stat, section, USER_ID concerned_person
    FROM table_all,
      left join table2
        on room_id = sectoion and
           sur_role = 'r001'
    WHERE section IN (SELECT code
                      FROM t_area
                      WHERE dept= 'p002')An alternative, depending on where and how you are using the statement would be something like:
    SQL> WITH t AS (
      2    select 1 id from dual union all
      3    select 2 id from dual),
      4  t1 as (
      5    select 1 id, 'One' descr from dual union all
      6    select 1, 'Un' from dual union all
      7    select 1, 'Une' from dual)
      8  SELECT t.id, CURSOR(SELECT t1.id, t1.descr from t1
      9                      WHERE t1.id = t.id)
    10  FROM t;
                      ID CURSOR(SELECTT1.ID,T
                       1 CURSOR STATEMENT : 2
    CURSOR STATEMENT : 2
                      ID DESCR
                       1 One
                       1 Un
                       1 Une
                       2 CURSOR STATEMENT : 2
    CURSOR STATEMENT : 2
    no rows selectedJohn

Maybe you are looking for

  • Intel graphic driver error update on satellite c850

    hi,recenty i want to update my laptop satellite c850, but every time i want to update this massage keep happen  I dont know what to do from this point...also can someone can get me the latest driver for toshiba satellite c850.. ? it was intel hd grap

  • Toshiba 320GB EXT HDD Boot Fault

    Hi all im new here only signed up because you guys seem to know your stuf!! I'm rather pc literate, im a music/video producer and use TWO Ext HD's to save most of my work. Ive had this Toshiba 320gb for around a year now, with no problems, never been

  • Exit code 2150 during startup

    Hi I just deployed spme sca files on 7.2 server. The deployment failed because server could not start. Now I could not start the server even from SAP MMC. Here is the log trace [Thr 4628] Thu Jul 08 14:11:14 2010 F  [Thr 4628] *** LOG => State change

  • Restrict SE16 for some tables

    I wanted to give access to users to SE16, but i want them to access on the some Z*Tables and Standard tables (BSID,BSAD ...). I tried to create a Group of Authorization with the tables in SE54 to insert in S_TABU_DIS, but I didn't get because some ta

  • Can not start OC4J_BI_FORM after PORTAL user password change

    We changed PORTAL password by going top sqlplus and OAS. Thinking it will make changes at both places. Now we see that when we start OAS. OC4J_BI_FORM does not start???