Want to Join two tables with cursors

Can anyone tell me how to join two tables only by cursors.
Not with:
1.Joining condition
2.Procedure etc.
Only cursors with passing parameters.
Sowmya

This is my assignment. I want to get the matching records from both tables. I have pk, fk for both tables for deptno.Can I pass parameter for this.
dept table:
deptno deptname
10 sales
20 Erp
30 hr
40     marketing
emp table:
Empno deptno Name
1 10 lee
2 20 hans
3 10 peter
4 30 james
5 30 king
Output should be:
deptno empname empno deptname
10 lee 1 sales
10 peter 3 erp
30 james 4 hr
30 king 5 marketing

Similar Messages

  • Join two tables with no matching records

    Hi All,
    I have two tables which have got data as below. Now I need to join those two tables but there are no matching rows or columns in those tables. I have used OUTER JOIN but query was taking more than 5 mnts to run. Whats the best way to join two tables where
    there are no matching records.
    Table : Sections &Table : orders 
    I am expecting the final output like I have mentioned below.
    How can i write a JOIN. Note there are no matching records from both the tables.
    Pls.This is a very urgent requirement.Regards
    -pep

    Thanks Elrand. I have one question. What if I want to add 10 more parameters in @Section table then
    the logic I have written below will not work. I will have to make it dynamic. Any suggestions.?
    declare @test table (RowNo INT,CokeType NVARCHAR(MAX),BeginUsage dateTIME)
    declare @Section table (SectionName NVARCHAR(100))
    insert into @Section values ('CokeType')
    insert into @Section values ('BeginUsage')
    insert into @test values (1,'OMV - 02E (04/2012)','01-02-2014')
    insert into @test values (2,'OMV - 02E (04/2012)','01-03-2014')
    insert into @test values (3,'PCIC - 01 (01E/2013)','01-04-2014')
    insert into @test values (4,'PCIC - 01 (01E/2013)','01-05-2014')
    insert into @test values (5,'PCIC - 01 (E) - 07/2011 & Alba /2010 (C/F) 05/2011','01-06-2014')
    select * from @Section
    select * from @test
    SELECT
    RowNo,SectionName,
    CASE
    WHEN(SectionName = 'CokeType') THEN CokeType
    ELSE
    CAST (BeginUsage AS VARCHAR(MAX))
    END
    AS DATA
    FROM @Section AS S
    CROSS APPLY
    (SELECT T.RowNo,T.CokeType,T.BeginUsage FROM @test T) P
    ORDER BY SectionName DESC

  • How to join two tables with no similar columns

    Hi all,
    I have two tables as follows:
    Table T1 have Attributes as follows:
    GLCODE,
    BRANCH,
    ITEM_NUMBER,
    DEMAND_DATE,
    QUANTITY,
    SOURCE
    Table T2 have Attributes as follows:
    FORECAST_DATE
    Now in SQL if run the following stattement iam getting out put.
    SELECT GLCODE,BRANCH,ITEM_NUMBER,DEMAND_DATE,QUANTITY, SOURCE,(SELECT DISTINCT FORECAST_DATE FROM T2) FROM T1
    The above SQL Statement giving correct results for me.
    The same SQL Statement how can we implement in mapping level?
    Regards,
    Ava

    Jaap van,
    >
    You have to specify an outer join, but how do you do that if there is no join to begin with? I would do the following (which I didn't test yet):
    add an extra column (say C_JOIN) to the T2-ingroup of the join operator and fill it with from a constant operator with say value 1. Then use T2.C_JOIN (+) = 1 as the join condition.
    If every record in T2 is guaranteed to have the same value, instead of using a deduplicator, which will read all records, sort them and deduplicate them, you can use a filter with filter condition ROWNUM < 2, which only will read one record.
    I am facing almost the same problem but not entirely thou and I was wondering if you have an idea how to even start.
    Problem:
    I got this table:SQL> desc ita.tpis32_job_status
    Name Null? Type
    JOBID NOT NULL NUMBER
    T1_ID NUMBER
    QID NUMBER
    REQ_TYPE VARCHAR2(10)
    SUBMIT_TIME DATE
    OWNERID VARCHAR2(30)
    DESCRIPTION VARCHAR2(150)
    STARTTIME DATE
    ENDTIME DATE
    STATUS VARCHAR2(50)
    ERROR_ID NUMBER
    TABLE_NAME VARCHAR2(30)
    SERVER_ID VARCHAR2(10)
    DATABASE VARCHAR2(20)
    PRIORITY NUMBER
    NUM_LINES NUMBER
    PROCESS_ID NUMBER
    QUE_TIME NUMBER
    STATUS_CODE NUMBER
    ERROR_MSG VARCHAR2(500)
    NUM_LINES_TS NUMBER
    REMOTE_STATUS NUMBER
    This the above table, i am looking for JOBID (a five digit number) like 25875.
    What I want to do is add or append this five digit number to a string to find the corresponding table in dba_tables or all_tables. The only way I have try to do this is by writing PLSQL as you see from here:
    Re: Use PLSQL to delete tables dynamically
    When the select is writing properly, the result of the five digit number from JOBID and the string should look like the below result (job_(five digit_%).
    My problem is there is no relationship between ALL_TABLES and the my own table (ita.tpis32_job_status). Any help will be appreciated.
    TABLE_NAME
    JOB_58871_OUTDATA
    JOB_58868_TS
    JOB_58868_OUTDATA
    JOB_58867_TS
    JOB_58867_CMDLBL_2
    JOB_58867_OUTDATA
    JOB_58866_TS

  • Outer join two tables with query search record attached to both tables

    When I create a query with two tables that have query search records attached with outer join, PS seems to do a natural join (cartesian). We are on PT8.48.
    Is there a workaround for this issue. I do not want to remove query search record on either of the tables.
    I am trying to create an Emergency contact report. I am using two tables PS_EMPLOYEES and PS_EMERGENCY_CNTCT. Here is the sql PeopleSoft query generated when I did Left outer Join.
    Query SQL:
    SELECT A.EMPLID, A.NAME, A.ADDRESS1, A.CITY, B.PRIMARY_CONTACT, B.ADDRESS1, B.CITY, B.STATE, B.POSTAL, B.RELATIONSHIP, A.DEPTID, A.JOBCODE, A.COMPANY, A.EMPL_TYPE
    FROM (PS_EMPLOYEES A LEFT OUTER JOIN PS_EMERGENCY_CNTCT B ON A.EMPLID = B.EMPLID ), PS_EMPLMT_SRCH_QRY A1, PS_PERS_SRCH_QRY B1
    WHERE A.EMPLID = A1.EMPLID
    AND A.EMPL_RCD = A1.EMPL_RCD
    AND A1.OPRID = 'SREESR'
    AND (B.EMPLID = B1.EMPLID OR B.EMPLID IS NULL )
    AND B1.OPRID = 'PS'
    Appreciate any help.

    I think there are fixes for this issue in later tools releases (Report ID 1544345000). I'm not sure about 8.48, but you might try the workaround documented in
    E-QR: Left Outer Joins with Security Records are returning unexpected results [ID 651252.1]
    on Oracle Support.
    Regards,
    Bob

  • Joining Two Tables with a DISTINCT column value

    I have two tables I need to join, but the 'left' table I only need DISTINCT for a column.
    create table t1
      bid  number(8),
      b_number number(8),
      dset varchar2(20),
      misc varchar2(20)
    create table t2
      cid  number(8),
      track number(8)
    select bid, cid
    from   ( select bid, b_number
                from   t1
                where dset = 'ABC1234'
                and    misc = 'TEXT'
             ) x,
             ( select cid, track
               from t2
               where exists ( select 1 from t2 where t2.track = t1.b_number )
             ) z
    where x.b_number = z.trackI only need records with DISTINCT cid values, but I keep getting multiple instanced of cid.
    Any suggestions?
    Thanks!

    Maybe this?
    select distinct cid
    from t2
    where track in
    select b_number
    from t1
    where dset = 'ABC1234'
    and misc = 'TEXT'
    )

  • Join two tables with an aggrefate funtion in it

    say I have two tables defined as
    t1(id1 number primary key, val1 varchar2(10));
    t2(id1 number, id2 number, val2 varchar2(10),
    constraint primary key(id1, id2),
    constraint foreign key id1 references t1(id1));
    The values in T1 are
    id1, val1
    1, abc
    2, def
    3, xyz
    The values in T2 are
    id1, id2, val2
    1, 1, pqr
    1, 2, mno
    2, 1, efg
    3, 1, def
    3, 2, fgh
    3, 3, hij
    i.e for each id1 in t1 there could be mulltiple values in T2.
    i need to get the val2 from t2 for each id1 in t1 where id2 is maximum
    The results should be
    1, 2, mno
    2, 1, efg
    3, 3, hij
    I can open a cursor for the records in t1 and can query for each row in T2 where id2 is maximum.
    but, how do I do this one join query.
    i did soem thing like
    select t1.id1, t2.id2, t2.val2
    from t1, t2
    where t1.id1 = t2.id1
    and exists (select 1 from t2 X where t2.id1 = t1.id1 and X.id2 = max(t2.id2)
    but it did not work!

    select t1.id1, t2.id2, t2.val2
    from t1, t2,
         (select id1, max(id2) id2
          from t2
          group by id1) t3
    where t1.id1 = t2.id1
    and t2.id1 = t3.id1
    and t2.id2 = t3.id2
    [\code]
    In this case you don't really need to reference t1 at all, but I'm assuming that this is a simplified version of what you need, and are pulling other values of t1 too.

  • Joining two tables with different DB

    Hi
    We have 2 sources DB2 and Oracle.
    In DB2 we have two tables which stores.
    Tbl1
    Case_no     Information1     Information2     Information3
    11112     sddf     asd     null null
    11113     asd     asd     null null
    Tbl2
    Inf     Info1     Code     Info3
    Xedy     Asdf     111     afder
    Mad     Tag     123     top
    The above tables are complex join with this condition
    Tbl1.case_no=Tbl1.case_no.
    Oracle tbl
    Code     Code_desc
    111     Very good
    123     bad
    My requirement is to join the tbl2 with Oracle tbl. Based on the codes in DB2 table I should display the Code_desc in my reports. Like this
    Case_no     Code     Code_desc
    11112     111     Very good
    11113     123     bad
    But I am getting the Cartesian result.
    Case_no     Code     Code_desc
    11112     111     Very good
    11112     123     bad
    11113     111     Very good
    11113     123     bad
    Please help to resolve.
    Regards
    MD

    Select Oracletbl and tbl2, right click on them open physical diagram, selected objects. In the physical diagram page Create a join between Oracletbl and tbl2 with the condition code=code.
    In business model create a complex join between these two. Now reload metadata/restart services check output.
    Let me know if this does not work you.

  • Joining Two Tables with Total Amount

    Hi All,
    I'm trying to join to tables P02 and P30 on the invoice no fields but getting duplicates. In table P30 we need to sum the payment column per invoice to get the actual payment amount. This then needs to Join to table P02. I have uploaded  sample
    data on this link and provided an example on how the output should like.
    https://app.box.com/s/pu8oa4f3jhrhm0ylshdz2fuo7541vn4z
    Thanks
    Jag

    I figured out why the duplicates appear. I'm attaching another table supplier to fill in the missing propcode when running the query below
    SELECT P02.P02_UNIQUE, p30.PROP_CODE, P02.SUPP_ALPHA+P02.SUPP_NUMERIC As SupplierCode, P02.INV_ALPHA+P02.INV_NUMERIC AS InvoiceNo,TotalPayment, Year, Month
    FROM P02
    CROSS APPLY (
                    SELECT PROP_CODE, SUM(TOTAL_AMOUNT) AS TotalPayment, P30.INVOICE_NUMB, DATEPART(year,[CREATED_DATE_SQL]) AS [Year], DATEName(Month,[CREATED_DATE_SQL]) AS [Month]
                    FROM dbo.P30
                    WHERE P02.INV_ALPHA+P02.INV_NUMERIC = P30.INVOICE_NUMB
                    GROUP BY PROP_CODE, COST_CENTRE, DATEPART(year,[CREATED_DATE_SQL]), DATEName(Month,[CREATED_DATE_SQL]), P30.INVOICE_NUMB
                    )P30
    Where P02.SUPP_ALPHA+P02.SUPP_NUMERIC = '668'
    Result below and the last row the prop_code is missing
    I have another table supplier which has the suppliercode and propcode so was trying to use the prop_code field from supplier table instead of P30 table to fill in the gap. But when i do that i get duplicates and wrong values.
    I have updated the sample data with supplier table.

  • Join two tables with the same information

    I have a registration database. It references two other tables. I accept registrations from Faculty and from Students, but their information is in two different tables. Both have fname and lname. If they have people_id filled in, I want the fname and lname from the People table. If they have student_id filled in, I want it from the Student table.
    I've never done this sort of IF situation. Here are the tables:
    create table passport_registration (
         passport_registration_id NUMBER Primary Key,
         date_added date,
         student_id NUMBER REFERENCES students(student_id),
         people_id NUMBER REFERENCES people(id),
         passport_listing_id NUMBER REFERENCES passport_listing(passport_listing_id)
    create table PEOPLE (
    id NUMBER Primary Key,
    dateModified date,
    fname VARCHAR2(100),
    lname VARCHAR2(100)
    create table students (
         student_id NUMBER Primary Key,
         date_added date,
         s_uid VARCHAR2(50),
         fname VARCHAR2(50),
         lname VARCHAR2(50)
    Any sort of assistance is appreciated.
    Thank you.
    daniel

    (It'd be helpful if you could edit your post and stick {noformat} before and after your sql statement - that will format it so that the (+){noformat} show correctly instead of being converted to the (+) symbol!)
    As to the questions:
    1. You've got two columns that have a decision to be made on them; you're going to need to write two sets of decision-making code, one for each column. I guess you could also do something like:select a.col1, d.col2, d.col3
    from table1 a, (select 'table2' cola, b.col1, b.col2, b.col3 from table2 b
    union all
    select 'table3' cola, c.col1, c.col2, c.col3 from table3 c) d
    where a.col1 = d.col1
    and nvl2(a.col2, 'table3', 'table2') = d.cola;
    nb, not tested, and I'm up far too late, so could have made an easy mistake!
    2. Yes, {noformat} (+){noformat} is the oracle method of doing outer joins; it could be rewritten into ansi joins if you like; I'm just not that familiar with them to do it myself!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Outer join two tables with two keys

    Hi,
    I have a question regard outer join,
    I have table A (Aid, ADesc), Table B(Bid, Bdesc), and Table C (Aid, Bid, Cdesc)
    There is data in Table A and B, but Table C is empty
    I want to outer join C with A and B with below query
    select ADesc,Bdesc, Cdest
    from A, B, C
    where A.Aid=C.Aid(+) and B.Bid(+)=C.Bid
    and A.Aid='XXX' and B.Bid(+)='ZZZ'
    The query result show only data in column Adesc , but column BDesc is empty even though there are some data in table B.
    How should the query been modified to correctly show ADESC and Bdesc.
    Thanks
    Vincent

    Guess the below should work:
    Case when records are available in Table C:
    with a as
    (select 'XXX' aid, 'adesc' adesc from dual),
    b as
    (select 'ZZZ' bid, 'bdesc' bdesc from dual),
    c as
    (select 'XXX' aid, 'ZZZ' bid, 'cdest' cdest from dual where 1 = 1)
    select ADesc,Bdesc, C1.Cdest
    from
    A LEFT OUTER JOIN C c1 ON (A.AID = C1.AID AND A.AID = 'XXX'),
    B LEFT OUTER JOIN C C2 ON (B.BID = C2.BID AND B.BID = 'ZZZ');
    Output:
    "ADESC"     "BDESC"     "CDEST"
    "adesc"     "bdesc"     "cdest"Case when table C is empty:
    with a as
    (select 'XXX' aid, 'adesc' adesc from dual),
    b as
    (select 'ZZZ' bid, 'bdesc' bdesc from dual),
    c as
    (select 'XXX' aid, 'ZZZ' bid, 'cdest' cdest from dual where 1 = 2)
    select ADesc,Bdesc, C1.Cdest
    from
    A LEFT OUTER JOIN C c1 ON (A.AID = C1.AID AND A.AID = 'XXX'),
    B LEFT OUTER JOIN C C2 ON (B.BID = C2.BID AND B.BID = 'ZZZ');
    "ADESC"     "BDESC"     "CDEST"
    "adesc"     "bdesc"     ""

  • Left outer join 3 tables with where-statement

    Hi folks,
    I hope you can understand (and maybe solve) my problem.
    Generally I try to left outer join three tables. The third table is used for a WHERE-statement.
    The three table structures are the following:
    table 1 (user)   
    user1 | key
    table 2 (detail)  
    key | ID
    table 3 (header)
    ID | user2                 
    ...and I want to achieve the following structure (as example filled with data):
    user | key | ID
    |-----|----
    xy    | a    | 001
    xy    | b    | #
    z     | b     | #
    The clue ist the usage of the third table. I need the table to set user1 and user2 equal (WHERE) but there are two problems:
    1) Obviously I can't left outer join two tables with each other. In this case I already used the 'key' of table 1 to join it with the 'key' of table 2. So I can't left outer join the 'ID' of table 2 with the 'ID' of table 3. Error message that I can only left outer join a table once. Any proposals?
    2) I have to include a WHERE to equal user1 with user2. But I am not allowed to use the user2 from table 3 because of the left outer join.
    I tried this coding:
    SELECT auser1 akey b~id INTO TABLE itab FROM ( table1 AS a
      LEFT OUTER JOIN table2 AS b ON akey = bkey )
      LEFT OUTER JOIN table3 AS c ON bID = cID )
      WHERE auser1 = cuser2.
    I would really appreciate your help.
    Regards
    MrclSpdl

    IF you want to join a DB table with an internal table, you need to use the 'FOR ALL ENTRIES' statement.
    select dbfields
    into table itab2
    from dbtab
    for all entries in itab
    where dbfield1 = itab-field1.
    This will get you a second internal table with all the corresponding data for the first selection.  You can then join them with a loop through the first table and a read table on the second table (for 1 - 1 relation) or a nested loop statement on both tables (for 1 - N relation).  Make itab a hashed table when using read table with key, use a sorted table if you need to loop without key access.
    Regards,
    Freek

  • Joining two tables in PL/SQL

    Hi there,
    I have two problems...first being:
    We are trying to run a sub-query within a WHERE/AND clause. I am not sure on the correct syntax on how to run the sub-query as denoted in the code below. Secondly I am trying to join two tables with a common column name (ie: CIPIDI_NR). Considering I cant fix the first problem I cant test out the sub-query. So any help on either would be grateful. Cheers
    Select *
    from TBL_CIPIDI
         WHERE CIPIDI_NR like nvl ('in_case_number%', CIPIDI_NR)
    AND CIPIDI_NAME like nvl ('in_case_name%', CIPIDI_NAME)
    AND COST_CENTRE LIKE NVL ('in_cost_centre%', COST_CENTRE)
    AND CIPIDI_DESCRIPTION like nvl ('in_description%', CIPIDI_DESCRIPTION)
    AND CLAIMANT_NAME LIKE NVL ('in_claimant%', CLAIMANT_NAME)
    AND REQUESTOR LIKE NVL ('in_requestor%', REQUESTOR)
    AND PROJECT_MANAGER LIKE NVL ('in_project_manager%', PROJECT_MANAGER)
    AND TEAM_LEADER LIKE NVL ('in_team_leader%', TEAM_LEADER)
         AND ********RUN THE QUERY BELOW************
    SELECT C1.CIPIDI_NR, C2.CIPIDI_NR
    from TBL_TEAM_MEMBERS C1, TBL_CIPIDI C2
         WHERE C1.CIPIDI_NR = C2.CIPIDI_NR
         AND TEAM_MEM_NAME LIKE NVL ('in_team_mem_name%', TEAM_MEM_NAME)
    );

    You really need to start providing create table and insert statements for tables and sample data for testing, the results that you want based on that data in order to clarify the problem, your Oracle version, and a copy and paste of an attempted run of your code, complete with any error messages received. The following is my best guess at what you might be looking for.
    Select *
    from   TBL_TEAM_MEMBERS C1, TBL_CIPIDI C2
    WHERE  C1.CIPIDI_NR = C2.CIPIDI_NR
    AND    c1.CIPIDI_NR          like nvl (in_case_number     || '%', c1.CIPIDI_NR)
    AND    c1.CIPIDI_NAME        like nvl (in_case_name       || '%', c1.CIPIDI_NAME)
    AND    c1.COST_CENTRE        LIKE NVL (in_cost_centre     || '%', c1.COST_CENTRE)
    AND    c1.CIPIDI_DESCRIPTION like nvl (in_description     || '%', c1.CIPIDI_DESCRIPTION)
    AND    c1.CLAIMANT_NAME      LIKE NVL (in_claimant        || '%', c1.CLAIMANT_NAME)
    AND    c1.REQUESTOR          LIKE NVL (in_requestor       || '%', c1.REQUESTOR)
    AND    c1.PROJECT_MANAGER    LIKE NVL (in_project_manager || '%', c1.PROJECT_MANAGER)
    AND    c1.TEAM_LEADER        LIKE NVL (in_team_leader     || '%', c1.TEAM_LEADER)
    AND    TEAM_MEM_NAME         LIKE NVL (in_team_mem_name   || '%', TEAM_MEM_NAME);

  • Join two tables FBL5N and collection management

    Hi All,
    I want to join two tables i.e T code FBL5N and table UDM_P2P_ATTR. But I am unable to see common fields/tables between the two. Can anyone suggest how can I join this in SE11. Pls suggest the common fiels between two indipendent tables.
    Thanks,
    Vishal Pant
    Edited by: vishal_pant on Jul 19, 2010 12:04 PM

    Neither  of these combinations  is possible with QuickViewer because the fields need to have the same length of characters in order to create the join.
    VBRK - VBLEN char(10) and BKPF - AWKEY char(20)
    VBRK -ZUONR char(18)     BKPF- BELNR char (10)
    Any other idea?
    Thank you, JP

  • Join two table in different instance

    Hi,
    I have two table in different instance .
    IMEI in instance A
    RCA_SMART_CARD in instance B
    Below is the desc table :
    SQL> desc RCA_SMART_CARD;
    Name Null? Type
    N_CARD_ID NOT NULL NUMBER(10)
    C_CARD_SERIAL_NUMBER NOT NULL VARCHAR2(20)
    C_SIM_MSISDN VARCHAR2(20)
    C_SIM_IMSI VARCHAR2(20)
    C_LINKED_CARD VARCHAR2(20)
    N_PRO_IDENTIFIER NOT NULL NUMBER(4)
    C_CARD_TYPE VARCHAR2(1)
    N_SIM_STATE NUMBER(1)
    N_EEPROM_SPACE_LEFT NUMBER(9)
    N_VOLATILE_SPACE_LEFT NUMBER(9)
    N_NONVOLATILE_SPACE_LEFT NUMBER(9)
    N_CARD_OPTI NOT NULL NUMBER(15)
    N_PRODUCT_ID NUMBER(10)
    D_CREATION_DATE DATE
    D_MODIFICATION_DATE DATE
    D_STATUS_MODIFICATION_DATE DATE
    SQL> desc IMEI;
    Name Null? Type
    MSISDN NOT NULL VARCHAR2(20)
    IMEI NOT NULL VARCHAR2(16)
    DATE_MOD NUMBER(13)
    IMSI VARCHAR2(18)
    ICCID VARCHAR2(20)
    T_PROF RAW(20)
    EXTRA_DATA VARCHAR2(100)
    If I want to join two table together .
    I want to search the number of record in IMEI that have N_SIM_STATE =1 in RCA_SMART_CARD .
    The MSISDN in IMEI is equal to C_SIM_MSISDN in RCA_SMART_CARD .
    How can I do and what is the sql statment ??
    Please advice .

    First you need to decide, from where you want to execute the query.
    Let us assume it is instance A(as per your example).
    Then what you need to do is:
    1.     Create database link to instance B
    *[url http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_5005.htm]Here* is the semantics.
    2.     After creating the database link to instance B, you can achieve the result set by running the below query:
            SQL> select count(*) from IMEI t1 join RCA_SMART_CARD@<db_link_name> t2 on t1.MSISDN = t2.C_SIM_MSISDN where t2.N_SIM_STATE = 1
            Hope it helps!
    Cheers,
    AA

  • Joining two tables LIKP and VBUK

    HI,
    I want to join two tables LIKP and VBUK, can u give some explaination ?
    points will be given for good answers...
    regards
    Vijaya

    Hi,
    see this example of joining two tables zairln & zflight.
    These 2 tables are logically joined by the airln field.
    Select a~airln
           a~lnnam
           b~fligh
           b~cntry
    Into table int_airdet
    From zairln as a inner join zflight as b on aairln = bairln.
    In order to restrict the data as per the selection criteria, a where clause can be added to the above inner join.
    rgds,
    latheesh
    Message was edited by: Latheesh Kaduthara

Maybe you are looking for