Fetch three tables

Is it possible to fetch 3 tables with single select query(without using view)

Hi,
Yes, you can use JOIN or FOR ALL ENTRIES.  Performance wise, For All Entries is better.
Try like this:
<u><b>JOIN:</b></u>
select zfpcdcadivi zfpcdproforma zfpcdfactura zfpcdaniofactura 
zfpcdmontousd zfpcdmontoap zfpcdebeln zfpcdinco1 
zfpcdlifnr lfa1name1 zcdvsstatus zfpcdconint 
into it_lista 
from zfpcd inner join zcdvs 
on zfpcdebeln = zcdvsebeln 
and zfpcdproforma = zcdvsproforma 
and zfpcdlifnr = zcdvslifnr 
inner join lfa1 
on zfpcdlifnr = lfa1lifnr 
where zcdvs~status = '04'. 
<u><b>FOR ALL ENTRIES:</b></u>
SELECT likpvbeln likplifex likpbldat likpwadat likpwadat_ist likpkodat likp~lfart
         likpkunnr likpvstel lipsposnv lipslfimg lipsvrkme lipslgmng lips~meins
         lipswerks lipslgort lipscharg lipsvbelv lipsposnr lipsmatnr
         lipsvbeln LIPSVGBEL LIPSVGPOS vbupkosta vbupwbsta vbupposnr vbup~vbeln
          VBAKIHREZ VBAKVBELN VBAP~VBELN
     INTO CORRESPONDING FIELDS OF TABLE  it_itab
    FROM ( likp
           INNER JOIN lips
           ON  lipsvbeln = likpvbeln
           INNER JOIN vbup
           ON  vbupposnr = lipsposnr
           and VBUPVBELN = LIPSVBELN )
          left outer join VBAK
          on  VBAKVBELN = LIPSVGBEL
          inner join VBAP
          on  VBAPVBELN = VBAKVBELN )
         WHERE likp~vbeln IN so_vbeln
           AND likp~lifex IN so_lifex
           AND likp~lfart IN so_lfart
           AND likp~kunnr IN so_kunnr
           AND likp~vstel IN so_vstel
           AND likp~bldat IN so_bldat
           AND likp~wadat_ist IN so_wadat
           AND vbup~kosta IN so_kosta
           AND vbup~wbsta IN so_wbsta
           AND LIPS~LFIMG NE 0.
Regards,
Bhaskar

Similar Messages

  • Fetch the data from three tables

    hi
    i have three table HR,plan ,voidplan
    HR table
    rep_id name
    1111 shyam
    2222 kavi
    3333 snaga
    PLAN table
    id rep_id name status
    1 1111 shyam approved
    2 2222 kavi pending
    VOID PLAN table
    id rep_id name status
    1 1111 shaym approved
    i got the row which is same in two table(HR and PLAN) using the query
    select rep_id from plan p,hr h where h.rep_id=p.rep_id and status='approved'
    so the output is
    rep_id
    1111
    now i need the solution to retrieve the rep from voidplan+plan table
    the result should be like this
    rep_id
    1111(from plan and hr)
    1111(void plan)
    please help me to solve this problem
    regards,
    vally.s

    how about UNION ALL
    select rep_id from plan p,hr h where h.rep_id=p.rep_id and status='approved'
    union all
    select rep_id from void_plan
    this will get only the rows that join and then ALL rows from void_plan (but I suspect this isn't what you want?)
    maybe you only want rows from void_plan that are returned from the first query
    select rep_id from void_plan v
    where v.rep_id in (select rep_id from plan p,hr h where h.rep_id=p.rep_id and status='approved'
    )

  • Fetching data from three tables.

    Hi All,
    I am having three tables company(com_id(PK),com_name),
    contact(contact_id(PK),com_id(FK),first_name,email),
    location(loc_id(PK),com_id(FK),country).
    I need a query to retrieve the first name,email,com_name and country.
    I used:
    select contact.first_name,contact.email,company.com_name,m.country from contact
    LEFT JOIN location m ON contact.com_id=m.com_id
    LEFT JOIN company c ON contact.com_id=c.com_id
    but its returning duplicate rows.
    I am new to this .Please tell me how to solve this problem.
    thanks,

    Jeeth wrote:
    Hi
    Thanks to all for the reply..
    I am using Oracle 10g
    Version:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - ProductionThat says you're uising Oracle 11 (11.2.0.1.0 to be precise), not 10.
    ... And the LOCATION Table containing:
    COM_ID     ADDRESS_ID COUNTRY
    28     1265     United States
    28     1266     United States
    381     381     United States
    610     1873     United States
    864     1586     United States
    869     870     United States
    2414     2662     United StatesPost CREATE TABLE and INSERT statments for your sample data.
    It helps if you explain what the data means. For example, this problem seems to hinge on location.com_id not being unique. What does each row, and each column, in the location table represent? What does each row in the output represent?
    Tried the Query:
    select d.first_name, d.email ,c.com_name , m.country from company c,contact d,location m
    where c.com_id=d.com_id and c.com_id=m.com_id
    I got the result: The second row is repeating:
    Alexander     [email protected]     JPMorgan Chase &amp; Co. (KEY ACCOUNT)     United States
    Alexander     [email protected]     ADP, Inc.      United States
    Alexander     [email protected]     ADP, Inc.      United States
    Alfred     [email protected]     Perficient Inc.     United States
    Allan     [email protected]     Progressive Insurance     United States
    Linda      [email protected]     Principal Financial Group, Inc.     United States
    Alycia     [email protected]     Emerson Electric Co. (KEY ACCOUNT)     United States
    Want output like:
    Alexander     [email protected]     JPMorgan Chase &amp; Co. (KEY ACCOUNT)     United States
    Alexander     [email protected]     ADP, Inc.      United States
    Alfred     [email protected]     Perficient Inc.     United States
    Allan     [email protected]     Progressive Insurance     United States
    Linda      [email protected]     Principal Financial Group, Inc.     United States
    Alycia     [email protected]     Emerson Electric Co. (KEY ACCOUNT)     United States
    Why do you want that ouptut, and not the output that you're originally getting?
    What output would you want if the part you were displaying were different on each row. For example, if we add a row like this to the sample data:
    COM_ID     ADDRESS_ID     COUNTRY
    2414     2663          MexicoThee are many different reasons why you could want the output you do. Each one has a different solution, that would produce different results with different data. You need to explain what you want to do, then someone can help you find a way to code it.
    The simplest way is to say SELECT DISTINCT . That happens to get the right results with the given sample data.

  • Single query for querying three tables

    Hi All,
    We are trying to construct a sql query(a single query), which can perform the below functionality.
    Assume, that there are three tables,
    TABLE1: 3 Columns
    1) ID -> PRIMARY KEY
    2) TYPE -> Allows only values 'A' or 'B'
    3) REF_ID(this can refer to TABLE2(ID) or TABLE3(ID)).
    TABLE2: 2 Columns
    1) ID -> PRIMARY KEY
    2) DETAILS -> Any normal text
    TABLE3: 2 Columns
    1) ID -> PRIMARY KEY
    2) DETAILS -> Any normal text
    We need to come up with a query that, given TABLE1's(ID), we need to fetch the corresponding record in TABLE1, and we need to fetch the corresponding record from TABLE2 or TABLE3, depending on the below conditions.
    If the TYPE for the TABLE1's(ID) is 'A'
    Then get the details from TABLE2's by mapping TABLE1.REF_ID = TABLE2.ID
    If the TYPE for the TABLE1's(ID) is 'B'
    Then get the details from TABLE3's by mapping TABLE1.REF_ID = TABLE3.ID
    We need to accomplish all these tasks in a single query.
    Thanks for your kindly help,
    Sreenivasan

    SQL> select * from test_qry1;
    ID T REF_ID
    1 A 100
    2 A 200
    3 B 300
    SQL> select * from test_qry2;
    ID DETAILS
    100 Human Resources
    200 It Services
    300 Relationships
    SQL> select * from test_qry3;
    ID DETAILS
    100 Human Beings
    200 Conference
    300 Used things
    SQL> SELECT t1.ID,
    DECODE(t1.type,'A',( SELECT t2.details FROM test_qry2 t2 WHERE t1.ref_id = t2.id
    'B',( SELECT t3.details FROM test_qry3 t3 WHERE t1.ref_id = t3.id
    ) details
    FROM test_qry1 t1;
    ID DETAILS
    1 Human Resource
    2 It Services
    3 Used things
    Try with this query.
    Thanks,
    Vissu......

  • ALV using three tables

    Hi frnz,
              I have to create a alv report using 1 header table, and two item tables.
                 But we can use  reuse_alv_hireseq_list only for two tables . so i cant' this function.
                  Can anybody send me sample code to create alv report using three tables.
    Regards.
    siva..

    Hi Siva,
    check this code. it will help you.
    REPORT  ZALV_HIERARCHYLIST .
    type-pools declarations for alv and icon
    TYPE-POOLS: slis,icon.*structure declaration for table details
    TYPES : BEGIN OF ty_dd02l,
            icon type icon_d,
            tabname TYPE tabname,
            tabclass TYPE tabclass,
            contflag type contflag,
            actflag type actflag,
            mainflag type maintflag,
            buffered type buffered,
            as4user type as4user,
            as4date type as4date,
            as4time type as4time,
            expand,
            END OF ty_dd02l.
    *internal table and wa decln for table details
    DATA : it_dd02l TYPE STANDARD TABLE OF ty_dd02l,
           wa_dd02l TYPE ty_dd02l.
    *structure declarations for field details
    TYPES : BEGIN OF ty_dd03l,
            tabname TYPE tabname,
            fieldname TYPE fieldname,
            keyflag type keyflag,
            mandatory type mandatory,
            checktable type checktable,
            rollname type rollname,
            END OF ty_dd03l.*Internal table and wa decln for field details
    DATA : it_dd03l TYPE STANDARD TABLE OF ty_dd03l,
           wa_dd03l TYPE ty_dd03l.*data declarations for ALVDATA : it_fieldcat TYPE slis_t_fieldcat_alv,
           wa_fieldcat TYPE slis_fieldcat_alv,
           it_layout TYPE slis_layout_alv,
           key TYPE slis_keyinfo_alv.*Input the tables.User cannot enter a range but can enter any number
    *of tables one by one in this select-options
    SELECT-OPTIONS : s_table FOR wa_dd02l-tabname NO INTERVALS.*initializatin event
    INITIALIZATION.
    *start-of-selection event
    START-OF-SELECTION.*subroutine to fetch the data from the tables
      PERFORM fetch_tabledata.
    *subroutine to build alv hierarchy output
      PERFORM hierarchyalv_build.&----
    *&      Form  hierarchyalv_build
          text
    -->  p1        text
    <--  p2        text
    form hierarchyalv_build .*fieldcatalogue
    perform build_fieldcat.
    *layout
    perform build_layout.
    *key information for hierarchy
    perform build_key.
    *output
    perform list_display.endform.                    " hierarchyalv_build
    *&      Form  build_fieldcat
          text
    -->  p1        text
    <--  p2        text
    form build_fieldcat .  CLEAR wa_fieldcat.  wa_fieldcat-col_pos = 1.
      wa_fieldcat-fieldname = 'TABNAME'.
      wa_fieldcat-tabname = 'IT_DD02L'.
      wa_fieldcat-seltext_m = 'Tablename'.
      wa_fieldcat-key = 'X'.
      wa_fieldcat-emphasize = 'C610'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = 2.
      wa_fieldcat-fieldname = 'TABCLASS'.
      wa_fieldcat-tabname = 'IT_DD02L'.
      wa_fieldcat-seltext_m = 'Tablecategory'.
        wa_fieldcat-emphasize = 'C600'.  APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = 3.
      wa_fieldcat-fieldname = 'CONTFLAG'.
      wa_fieldcat-tabname = 'IT_DD02L'.
      wa_fieldcat-seltext_m = 'DeliveryClass'.
        wa_fieldcat-emphasize = 'C510'.  APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
    CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = 4.
      wa_fieldcat-fieldname = 'ACTFLAG'.
      wa_fieldcat-tabname = 'IT_DD02L'.
      wa_fieldcat-seltext_m = 'Activationstatus'.
      wa_fieldcat-emphasize = 'C500'.  APPEND wa_fieldcat TO it_fieldcat.   CLEAR wa_fieldcat.  wa_fieldcat-col_pos = 5.
      wa_fieldcat-fieldname = 'MAINFLAG'.
      wa_fieldcat-tabname = 'IT_DD02L'.
      wa_fieldcat-seltext_m = 'MaintainenceFlag'.
        wa_fieldcat-emphasize = 'C410'.  APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = 6.
      wa_fieldcat-fieldname = 'BUFFERED'.
      wa_fieldcat-tabname = 'IT_DD02L'.
      wa_fieldcat-seltext_m = 'BufferFlag'.
      wa_fieldcat-emphasize = 'C400'.  APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
    CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = 7.
      wa_fieldcat-fieldname = 'AS4USER'.
      wa_fieldcat-tabname = 'IT_DD02L'.
      wa_fieldcat-seltext_m = 'User'.
      wa_fieldcat-emphasize = 'C310'.  APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = 8.
      wa_fieldcat-fieldname = 'AS4DATE'.
      wa_fieldcat-tabname = 'IT_DD02L'.
        wa_fieldcat-seltext_m = 'Date'.
      wa_fieldcat-emphasize = 'C300'.  APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
    CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = 9.
      wa_fieldcat-fieldname = 'AS4TIME'.
      wa_fieldcat-tabname = 'IT_DD02L'.
        wa_fieldcat-seltext_m = 'Time'.
      wa_fieldcat-emphasize = 'C210'.  APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      CLEAR wa_fieldcat.  wa_fieldcat-col_pos = 10.
      wa_fieldcat-fieldname = 'ICON'.
      wa_fieldcat-tabname = 'IT_DD02L'.
      wa_fieldcat-seltext_m = 'ICON'.
      wa_fieldcat-ICON = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.  wa_fieldcat-col_pos = 11.
      wa_fieldcat-fieldname = 'FIELDNAME'.
      wa_fieldcat-tabname = 'IT_DD03L'.
      wa_fieldcat-key = 'X'.
      wa_fieldcat-seltext_m = 'Field'.
      wa_fieldcat-EMPHASIZE = 'C600'.  APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.  wa_fieldcat-col_pos = 12.
      wa_fieldcat-fieldname = 'KEYFLAG'.
      wa_fieldcat-tabname = 'IT_DD03L'.
      wa_fieldcat-seltext_m = 'Key'.
      wa_fieldcat-EMPHASIZE = 'C500'.  APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.  wa_fieldcat-col_pos = 13.
      wa_fieldcat-fieldname = 'CHECKTABLE'.
      wa_fieldcat-tabname = 'IT_DD03L'.
      wa_fieldcat-seltext_m = 'Checktable'.
      wa_fieldcat-EMPHASIZE = 'C400'.  APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.  wa_fieldcat-col_pos = 14.
      wa_fieldcat-fieldname = 'MANDATORY'.
      wa_fieldcat-tabname = 'IT_DD03L'.
      wa_fieldcat-seltext_m = 'Mandatory'.
        wa_fieldcat-EMPHASIZE = 'C300'.
      APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.  wa_fieldcat-col_pos = 15.
      wa_fieldcat-fieldname = 'ROLLNAME'.
      wa_fieldcat-tabname = 'IT_DD03L'.
      wa_fieldcat-seltext_m = 'Dataelement'.
      wa_fieldcat-EMPHASIZE = 'C200'.  APPEND wa_fieldcat TO it_fieldcat.endform.                    " build_fieldcat
    *&      Form  build_layout
          text
    -->  p1        text
    <--  p2        text
    form build_layout .*to expand the header table for item details
      it_layout-expand_fieldname = 'EXPAND'.  it_layout-window_titlebar = 'Hierarchical ALV list display'.
      it_layout-lights_tabname = 'IT_DD03L'.
      it_layout-colwidth_optimize = 'X'.
    endform.                    " build_layout
    *&      Form  build_key
          text
    -->  p1        text
    <--  p2        text
    form build_key .*key infomation for the header and item table
      key-header01 = 'TABNAME'.
      key-item01 = 'TABNAME'.endform.                    " build_key&----
    *&      Form  list_display
          text
    -->  p1        text
    <--  p2        text
    form list_display .*ALV output
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
          i_callback_program = sy-cprog
          is_layout          = it_layout
          it_fieldcat        = it_fieldcat
          i_tabname_header   = 'IT_DD02L'
          i_tabname_item     = 'IT_DD03L'
          is_keyinfo         = key
        TABLES
          t_outtab_header    = it_dd02l
          t_outtab_item      = it_dd03l.endform.                    " list_display
    *&      Form  fetch_tabledata
          text
    -->  p1        text
    <--  p2        text
    form fetch_tabledata .*select table data
    SELECT tabname
             tabclass
             contflag
             actflag
             mainflag
             buffered
             as4user
             as4date
             as4time
             FROM dd02l
             INTO CORRESPONDING FIELDS OF TABLE it_dd02l
             WHERE tabname IN s_table.*select field data
      IF it_dd02l[] IS NOT INITIAL.    SELECT tabname
              fieldname
              keyflag
              mandatory
              checktable
              rollname
              FROM dd03l
              INTO CORRESPONDING FIELDS OF TABLE it_dd03l
              FOR ALL ENTRIES IN it_dd02l
              WHERE tabname EQ it_dd02l-tabname.  ENDIF.*adding icon to the header table
    loop at it_dd02l into wa_dd02l.at new tabname.wa_dd02l-icon = '@3M@'.MODIFY it_dd02l FROM wa_dd02l TRANSPORTING icon WHERE tabname EQ wa_dd02l-tabname.
    CLEAR :  wa_dd02l.endat.endloop.endform.                    " fetch_tabledata
    Have a nice day,
    venkat

  • Code to Join three tables.

    Hi All,
    I am a fresher to this ABAP.
    I have an task to join three tables which doesn't take much effort. But the problem is: the tables have same columns, (name, age and city) in all the three tables.
    The layout is as shown below:
    Table 1  ( T1 )            Table 2  ( T2 )          Table 3 ( T3 )
      name | age | city      name | age | city        name | age | city    -
    Anju   21     HDD      Anju   20     BGH       Anju    21    SFF
    Julie   23     JUH       Julie   24     JUH        Julie   20     JUH
    Now, there should be a selection screen. If I enter a value for this varaible as "Anju", The output should be like:
    Col       T1        T2      T3
    Name    Anju     Anju    Anju
    Age       21        20       21
    City       HDD    BGH    SFF
    I am unable to appraoch how to solve this issue. Any pointers would be of great help.
    Thanks in advance,
    Anjum.
    Edited by: nasarat anjum on Apr 23, 2008 8:43 AM

    Hi,
    U can take three internal tables for each of ur tables T1,T2,T3. Fetch the respective table data into ur internal tables.
    Then write,
    loop at itab1.
    read table itba2 with key name eq itab1-name.
    read table itab3 with key name eq itab1-name.
    write : / name under <name heading>,
                itab1-name under <T1 heading>,
                itab2-name under <T2 heading>,
                itab3-name under <T3 heading>.
    write : / age under <age heading>,
                itab1-age under <T1 heading>,
                itab2-age under <T2 heading>,
                itab3-age under <T3 heading>.
    write : / city under <city heading>,
                itab1-city under <T1 heading>,
                itab2-city under <T2 heading>,
                itab3-city under <T3 heading>.
    <removed by moderator>
    Thanks
    Edited by: Mike Pokraka on Aug 6, 2008 8:30 AM

  • Generic Extraction By Using function Module with Three Table fields?

    Hi,
    I need to bring the data from three tables by using function module.
    Tables: VBAK, VBAP, VBUK.
    Fields are: VBELN, ERDAT, NETWR, WEARK, POSNR, MATNR, FKART, FKTYP.
    i referred some of the documents in SDN, it explained by using two table fields.
    Please help me.

    hi, the below pseudo code should help you on creating the logic. It's based on the how to paper. So i just used the parts of intrest. You need to copy the rest form the document. Please notice that this is pseudo code. if you just copy/paste, it will not work.
    IF s_counter_datapakid = 0.
    OPEN CURSOR WITH HOLD s_cursor FOR
           SELECT fields       FROM table1         WHERE condition
          ENDIF.                             "First data package ?
    * Fetch records into interface table.
    *   named E_T_'Name of extract structure'.
          FETCH NEXT CURSOR s_cursor
                    INTO  TABLE e_t_data
                    PACKAGE SIZE s_s_if-maxsize.
         IF sy-subrc EQ 0.
           SELECT fields      FROM table2      WHERE condition into itab2 for all entries in e_t_data
           SELECT fields      FROM table3       WHERE condition into itab3 for all entries in e_t_data    
         loop at e_t_data
              read itab2. move corresponding fields to e_t_data
              read itab3. move corresponding fields to e_t_data
              collect e_t_data.
         endif.
    IF sy-subrc <> 0.
           CLOSE CURSOR s_cursor.
           RAISE no_more_data.
         ENDIF.
         s_counter_datapakid = s_counter_datapakid + 1.
       ENDIF.              "Initialization mode or data extraction ?

  • Report using three tables on group basis

    Hi,
    I wish to know a clue for the follwing report among three tables either using join or sub-query or PL/SQL Script as per the below desired output.
    Top 10 games by uniques / by volume
    It should produce something like this:
    Game     Uniques     Volumes     Game Start     Game End     Mins on Air     
    Top 5 movies beginning with "D"     2734     7924     9/24/06 9:59 PM     9/24/06 10:41 PM     42     
    Top 5 One Hit Wonders     2355     6471     9/24/06 9:07 PM     9/24/06 9:48 PM     41     
    Things you find in The Kitchen     1336     3600     9/24/06 10:41 PM     9/24/06 10:59 PM     18     
    Twisted Title Men in Black     770     1435     9/24/06 9:53 PM     9/24/06 9:59 PM     6     
    Anagram Lance Armstrong     884     1350     9/24/06 9:48 PM     9/24/06 9:53 PM     5     
    A.Bucks Jack and Jill...     593     824     9/24/06 8:59 PM     9/24/06 9:04 PM     4     
    Missing link ANY101     649     815     9/24/06 9:04 PM     9/24/06 9:07 PM     3     
    Parameters should be startDate and endDate.
    This query can be obtained from using the following tables: Calls, Games, Events, Event_Types
    Calls have a timestamp.
    Every game has event, such as start game or end game (see Event_Types), with its timestamp
    Volumes: Number of calls received for each game between start game date and end date
    Uniques: Unique Number of calls received for each game between start game date and end date
    (distinct cli)
    Mins on air: differences between start call and end call
    Relationship:
    The ID column from games table and game_id from events table is common.
    Assume if the event type id is 2 then it starts game and if 3 then game ends. Other type is irrelevant for this query.
    The id from event_type is mentioned in another table event_types as master with description. But it is not required to establish relationship with this table. As this code ( 2 or 3) is alredy availbel with event_type_id in the events table.
    Please assume the CLI number as dummy data.
    I have provided the structure and query to generate tables and populate testing data to sort out this issue at the earliest.
    I tried to perform this query but I wish to compare the result with the script given by experts as I’m not a core developer.
    1) desc calls
    Name Null? Type
    CLI NOT NULL VARCHAR2(255)
    CALL_DATE NOT NULL TIMESTAMP(6)
    insert into values('&CLI','&call_date')
    select substr(CLI,1,10),substr(call_date,1,22) from calls
    SUBSTR(CLI SUBSTR(CALL_DATE,1,22)
    0662740929 22-SEP-06 05.22.44.123
    0662740973 22-SEP-06 05.22.47.123
    0662740956 22-SEP-06 05.22.46.123
    0662740980 22-SEP-06 05.22.47.123
    0662740936 09-MAY-06 05.22.44.123
    0762740954 22-SEP-06 05.22.45.123
    0762740936 09-MAY-06 05.22.47.123
    0762740921 22-SEP-06 05.22.44.123
    0113456789 22-SEP-06 05.47.04.082
    0987654321 22-SEP-06 06.16.29.727
    0 22-SEP-06 06.17.28.141
    SUBSTR(CLI SUBSTR(CALL_DATE,1,22)
    0123456789 09-MAY-06 06.27.51.224
    0112740929 22-SEP-06 06.28.43.398
    0123456789 09-MAY-06 06.30.10.830
    0044791475 24-SEP-06 04.38.08.564
    0044791475 24-SEP-06 04.40.05.777
    0123456789 24-SEP-06 05.32.22.267
    0147258369 24-SEP-06 05.34.25.652
    0852147963 24-SEP-06 05.52.56.992
    0123456789 25-SEP-06 01.34.17.157
    0683379112 25-SEP-06 01.35.19.461
    0 25-SEP-06 03.09.12.347
    SUBSTR(CLI SUBSTR(CALL_DATE,1,22)
    0141411683 25-SEP-06 03.21.07.402
    0141411683 25-SEP-06 03.21.38.519
    0618769562 02-JUN-06 03.22.12.807
    0123456789 02-JUN-06 03.24.11.387
    0 25-SEP-06 03.25.13.152
    0141412179 25-SEP-06 03.25.38.424
    0123456789 02-JUN-06 03.26.57.687
    0607069617 02-JUN-06 03.27.02.720
    0014141168 26-SEP-06 03.30.55.290
    0618769562 25-SEP-06 03.31.21.141
    0141411683 25-SEP-06 03.31.45.952
    SUBSTR(CLI SUBSTR(CALL_DATE,1,22)
    0607069617 25-SEP-06 03.32.14.542
    0618769562 25-SEP-06 03.32.30.433
    0 25-SEP-06 03.32.43.292
    0141412179 25-SEP-06 03.33.07.166
    0 25-SEP-06 03.33.56.086
    0 25-SEP-06 03.34.03.918
    0123456789 26-SEP-06 03.34.21.193
    0 25-SEP-06 03.34.25.484
    0 25-SEP-06 03.34.39.126
    0 25-SEP-06 03.34.40.354
    0 25-SEP-06 03.34.51.231
    2)
    SQL> desc events
    Name Null? Type
    EVENT_TYPE_ID NOT NULL NUMBER(19)
    EVENT_DATE NOT NULL TIMESTAMP(6)
    GAME_ID NUMBER(19)
    insert into events values ('&EVENT_TYPE_ID','&EVENT_DATE',&GAME_ID')
    SQL> select substr(event_type_id,1,10),substr(event_date,1,20),substr(game_id,1,10) from events where game_id in (1918,1919,1920,1939,1958,1979,1999,2018,2040,2041,2061)
    SUBSTR(EVE SUBSTR(EVENT_DATE,1, SUBSTR(GAM
    3 26-APR-06 06.11.50.8 1939
    4 26-APR-06 06.12.05.6 1939
    5 26-APR-06 06.16.13.5 1939
    3 09-MAY-06 06.18.59.7 1920
    4 09-MAY-06 06.22.43.7 1920
    3 12-MAY-06 04.24.46.2 1920
    4 12-MAY-06 04.46.22.5 1920
    3 12-MAY-06 04.29.07.4 1920
    4 12-MAY-06 04.39.31.1 1920
    3 12-MAY-06 04.29.35.3 1920
    4 12-MAY-06 04.30.02.8 1920
    SUBSTR(EVE SUBSTR(EVENT_DATE,1, SUBSTR(GAM
    3 26-SEP-06 12.19.27.6 1958
    4 26-SEP-06 12.29.37.9 1958
    5 01-JUN-06 12.26.37.2 1958
    3 02-JUN-06 11.53.49.0 1979
    6 02-JUN-06 11.54.00.5 1979
    4 02-JUN-06 11.54.55.5 1979
    3 02-JUN-06 11.55.03.7 1979
    4 02-JUN-06 11.57.40.7 1979
    3 02-JUN-06 11.57.43.5 1979
    4 02-JUN-06 11.59.47.2 1979
    3 14-SEP-06 02.24.13.8 1999
    SUBSTR(EVE SUBSTR(EVENT_DATE,1, SUBSTR(GAM
    4 14-SEP-06 02.55.18.7 1999
    3 14-SEP-06 06.44.40.1 1999
    4 14-SEP-06 06.52.57.9 1999
    3 22-SEP-06 04.05.09.5 2018
    4 22-SEP-06 05.24.14.7 2018
    5 22-SEP-06 05.24.25.0 2018
    4 24-SEP-06 03.17.54.8 2018
    3 24-SEP-06 03.19.00.1 2018
    3) INSERT INTO games VALUES ('&ID'.'&NAME')
    SQL> desc games
    Name Null? Type
    ID NOT NULL NUMBER(19)
    NAME NOT NULL VARCHAR2(255)
    select substr(id,1,10),substr(name,1,25) from games;
    SUBSTR(ID, SUBSTR(NAME,1,25)
    1918 Copy of QN27030628
    1919 Copy of Copy of QN0104061
    1920 Copy of Copy of Copy of Q
    1939 Alex Game 8
    1958 QN27030628 Lee
    1979 Copy of QN01040611 9
    1999 Ale's Game
    2018 TF1 Game test 1
    2040 Test Game TF1sarah
    2041 BTAgilemedia Game Test
    2061 Copy of Copy of QN0104060
    Your help would be highly appreciated.
    Thanks
    Jayesh

    Hi,
    I am sending herewith SQL statement for populating data into the concern tables
    To make easier for further testing your script.
    insert into calls values (0772740929, 22-SEP-06 05.22.44.123)
    insert into calls values (0882740929, 22-SEP-06 05.22.44.123)
    insert into calls values (0772740929, 25-SEP-06 05.22.44.123)
    insert into calls values (0662740929, 27-SEP-06 05.22.44.123)
    insert into calls values (0452740929, 22-SEP-06 05.22.44.123)
    insert into calls values (0992740929, 24-SEP-06 05.22.44.123)
    insert into calls values (0992740929, 26-SEP-06 05.22.44.123)
    insert into events values (3, 22-SEP-06 05.22.44.123,1918)
    insert into events values (4, 22-SEP-06 05.32.44.123,1918)
    insert into events values (3, 24-SEP-06 05.22.44,1920)
    insert into events values (4, 24-SEP-06 05.42.44,1920)
    insert into events values (3, 26-SEP-06 05.22.44,1958)
    insert into events values (4, 26-SEP-06 05.52.44,1958)
    Insert into games values (1918,’ Copy of QN27030628’)
    Insert into games values (1920,’ Test Game TF1sarah’)
    Insert into games values (1958,’ Test Car Race’)
    Thanks
    jayesh

  • How can i get all the records from three tables(not common records)

    Hi
    I have four base tables at R/3-Side. And i need to extract them from R/3-Side.
    And i dont have any standard extractor for these tables .
    If i create a 'View' on top of these tables. Then it will give only commom records among the three tables.
    But i want all the records from three base tables (not only common).
    So how can i get the all records from three tables. please let me know
    kumar

    You can create separate 3 datasources for three tables and extract data to BW. There you can implement business login to build relation between this data.

  • How can i Delete the data from three tables at a time  using same key.

    I am New to Oracle ADF, I have a Requirement Like these, I have three tables like Employee,Salaries,Teams all of these are having one common EmpNo as common attribute, I have Search form these will return the all the employees related to that search query, when i click on Delete button the particular employe Data should delete from all the three tables based on the EmpNo.
    Any Help is appreciable..

    1) The easiest way is to mark the foreign key constraints from SALARIES to EMPLOYEES and from TEAMS to EMPLOYEES as ON DELETE CASCADE. The DB server will then delete the necessary rows whenever you delete an employee row.
    2) Another way is to implement a Before-Delete-Row DB trigger on the EMPLOYEES table where you can delete the related rows in the other tables (have in mind, that if you have foreign keys you may get a Mutating Table Exception, so this approach might be not very good).
    3) An ADF way is to implement a custom EntityImpl class for the Employee entity and to override the remove() method where you can lookup the related TeamMember and Salary entities (through EntityAssoc accessors) and invoke their remove() methods too.
    4) Another ADF way is to implement a custom EntityImpl class for the Employee entity and to override the doDML() method where you can delete the necessary rows in SALARIES and TEAMS tables through JDBC calls whenever a DELETE operation is being performed on the underlying Employee entity.
    Dimitar

  • Rectifications of different sizes for all the three table lines in footer.

    Hi friendz,
                    i am working in ecc6 system(smartforms).
                    i am using 3 table lines in the footer one for total, the second one for tax calculation, and the third one for the grand total.
    But in the output screen display - the total, tax and grand total(in different table lines) are displayed with different heights, which gives unprofessional look for the form.
    i want all the table lines in the footer to display with equal heights.

    Hi,
    first you create LTYPE follow below sequence
    Go table tab--> details tab--->give suitable heights for ltype
    next go to FOOTER in the main window
    create three table lines under footer like
    FOOTER1
    FOOTER2
    FOOTER3
    for three table lines we need to assign line type LTYPE
    Go FOOTER1 ---> output options -
    > give LTYPE.
         FOOTER2 ---> output options -
    > give LTYPE.
         FOOTER3 ---> output options -
    > give LTYPE.
    reward points if helpful.
    Regards,
    Bhupal.
    Edited by: bhupal reddy on Jul 22, 2008 11:55 AM

  • DBMS_DATAPUMP How to ignore two or three tables

    Hi,
    I have to export complete schema using DBMS_DATAPUMP . 
    What is the syntax    to ignore  two or three tables from this schema .

    your above code not woking
         dbms_datapump.metadata_filter
         (handle=>handle
         ,name=>'NAME_EXPR'
         ,value=>' NOT IN (SELECT TABLE_NAME FROM DBA_TABLES WHERE TABLE_NAME LIKE ''YOU%'')'
    it shows the following error message
    Error report:
    ORA-39001: invalid argument value
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
    ORA-06512: at "SYS.DBMS_DATAPUMP", line 3444
    ORA-06512: at "SYS.DBMS_DATAPUMP", line 3693
    ORA-06512: at line 20
    39001. 00000 -  "invalid argument value"
    but following  codes working fine
      Dbms_Datapump.Metadata_Filter(handle => h1,name => 'NAME_EXPR',value => '!=''SU_HANDSET_HISTORY''',
        object_type => 'TABLE');

  • Generate a report with three table

    hi Friends,
    i have three table
    1-
    CREATE TABLE "TRANSACTION_DETAILS"
    (     "S_NO" NUMBER,
         "BILL_NO" NUMBER,
         "BILL_DATE" DATE,
         "PARTY_NAME" VARCHAR2(1000),
         "VEHICLE_NO" VARCHAR2(20),
         "ITEM_NAME" VARCHAR2(500),
         "DESCRIPTION" VARCHAR2(4000),
         "QTY" NUMBER,
         "RATE" NUMBER,
         "AMOUNT" NUMBER,
         CONSTRAINT "TRANSACTION_DETAILS_CON" PRIMARY KEY ("S_NO") ENABLE
    2-
    CREATE TABLE "LAB_WORK_DTL"
    (     "ID" NUMBER,
         "BILL_NO" NUMBER,
         "BILL_DATE" DATE,
         "PARTY_NAME" VARCHAR2(1000),
    "VEHICLE_NO" VARCHAR2(20),
         "WORK_DETAIL" VARCHAR2(4000),
         "LABOUR_AMT" NUMBER,      
         CONSTRAINT "LAB_WORK_DTL_PK" PRIMARY KEY ("ID") ENABLE
    3-
    CREATE TABLE "JOB_CARD_DETAILS"
    (     "ID2" NUMBER,
         "BILL_NO" NUMBER,
         "BILL_DATE" DATE,
         "PARTY_NAME" VARCHAR2(1000),
         "VEHICLE_NO" VARCHAR2(20),
         "AMOUNT" NUMBER,
         CONSTRAINT "JOB_CARD_DETAILS_CON" PRIMARY KEY ("ID2") ENABLE
    i want to generate a Report of total amout of bill No Like
    BILL_NO,BILL_DATE,VEHICLE_NO,SUM(AMOUNT) ,SUM(LABOUR_AMT),SUM(AMOUNT)
    I AM USING
    select a.BILL_NO,a.BILL_DATE,a.PARTY_NAME,a.VEHICLE_NO,SUM(a.AMOUNT),SUM(b.LABOUR_AMT),SUM(c.AMOUNT) from TRANSACTION_DETAILS a,LAB_WORK_DTL b,JOB_CARD_DETAILS c where a.PARTY_NAME =b.PARTY_NAME and a.PARTY_NAME=c.PARTY_NAME and a.PARTY_NAME =:P38_PARTY_NAME group by a.bill_no,a.BILL_DATE,a.PARTY_NAME,a.VEHICLE_NO,b.bill_no,b.BILL_DATE,b.PARTY_NAME,b.VEHICLE_NO,c.bill_no,c.BILL_DATE,c.PARTY_NAME,c.VEHICLE_NO
    ACCORDING TO THIS CODE sum of these column SUM(a.AMOUNT),SUM(b.LABOUR_AMT),SUM(c.AMOUNT) are not correct and there are one more problem if BILL_NO is not in LAB_WORK_DTL JOB_CARD_DETAILS these table then result shows NO DATA FOUND but BILL_NO is avalable in
    TRANSACTION_DETAILS this table.
    How can i generate this report .
    Thanks
    Manoj Kaushik

    1-
    CREATE TABLE  "TRANSACTION_DETAILS"
    (     "S_NO" NUMBER,
         "BILL_NO" NUMBER,
         "BILL_DATE" DATE,
         "PARTY_NAME" VARCHAR2(1000),
         "VEHICLE_NO" VARCHAR2(20),
         "ITEM_NAME" VARCHAR2(500),
         "DESCRIPTION" VARCHAR2(4000),
         "QTY" NUMBER,
         "RATE" NUMBER,
         "AMOUNT" NUMBER,
          CONSTRAINT "TRANSACTION_DETAILS_CON" PRIMARY KEY ("S_NO") ENABLE
    2-
    CREATE TABLE  "LAB_WORK_DTL"
    (     "ID" NUMBER,
         "BILL_NO" NUMBER,
         "BILL_DATE" DATE,
         "PARTY_NAME" VARCHAR2(1000),
    "VEHICLE_NO" VARCHAR2(20),
         "WORK_DETAIL" VARCHAR2(4000),
         "LABOUR_AMT" NUMBER,      
          CONSTRAINT "LAB_WORK_DTL_PK" PRIMARY KEY ("ID") ENABLE
    3-
    CREATE TABLE  "JOB_CARD_DETAILS"
    (     "ID2" NUMBER,
         "BILL_NO" NUMBER,
         "BILL_DATE" DATE,
         "PARTY_NAME" VARCHAR2(1000),
         "VEHICLE_NO" VARCHAR2(20),
         "AMOUNT" NUMBER,
          CONSTRAINT "JOB_CARD_DETAILS_CON" PRIMARY KEY ("ID2") ENABLE
    /Can you define the relation between these three tables. I see in your sql you are joining the three table with the column PARTY_NAME. Is that the proper joining condition? Can you explain that.
    And also when you say this
    ACCORDING TO THIS CODE sum of these column SUM(a.AMOUNT),SUM(b.LABOUR_AMT),SUM(c.AMOUNT) are not correct What exactly do you mean. What is not correct? Can you show some sample data.
    And also it would be of great help to all the people here if you format your SQL and use {noformat}{noformat} tag to preserve the format of your code.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Please tell me the  Three table INNER JOIN Sql statement

    Hi experts,
      I got requirement like by using INNER JOIN i have to write the code in MY program i.e using 3 tables VBAK VBAP and VBUK.And the common field is VBELN .SO please give the  INNER JOIN SQL statement for above three tables...
    vbak-vbeln,erdat
    vbap-vbeln,posnr
    vbuk-vbeln,RFSTK
    Thanks in Advance

    hi guglani  please see my total code b.caus DATA is not extracting...once see the code  correct error.
    DATA:V_VBELN TYPE VBAK-VBELN.      "VBAK,VBAP AND VBUK
    SELECT-OPTIONS SORDER FOR V_VBELN.
    TYPES:BEGIN OF T_VBAK,
         VBELN TYPE VBELN_VA,
         ERDAT TYPE ERDAT,
      END OF T_VBAK.
    TYPES:BEGIN OF T_VBAP,
           VBELN TYPE VBELN_VA,
            POSNR TYPE POSNR_VA,
      END OF T_VBAP.
    TYPES:BEGIN OF T_VBUK,
        VBELN TYPE VBELN,
      RFSTK TYPE RFSTK,
      END OF T_VBUK.
    TYPES:BEGIN OF FS,
       VBELN TYPE VBELN_VA,
         ERDAT TYPE ERDAT,
    POSNR TYPE POSNR_VA,
      RFSTK TYPE RFSTK,
      END OF FS.
    DATA:WA1 TYPE T_VBAK,
         WA2 TYPE T_VBAP,
         WA3 TYPE T_VBUK,
         WA TYPE FS.
    DATA:ITAB1 TYPE TABLE OF T_VBAK,
          ITAB2 TYPE TABLE OF T_VBAP,
          ITAB3 TYPE TABLE OF T_VBUK,
          ITAB TYPE TABLE OF FS.
    select a~vbeln a~erdat b~posnr c~rfstk
           from vbak as a inner join vbAP as b on a~vbeln = b~vbeln
                          inner join vbuk as c on a~vbeln = c~vbeln
    into table itab
    where A~vbeln eq SORDER.
    IF NOT ITAB IS INITIAL.
      SORT ITAB BY VBELN.
    ENDIF.
    LOOP AT ITAB INTO WA.
       WRITE:/ WA-VBELN,WA-ERDAT,WA-rfstk.
       ENDLOOP.
       CLEAR WA.
       REFRESH ITAB.

  • Pl/sql block to retrieve information from three tables.

    Hi Everyone,
    I have three tables. Student table, bookDetails table and bookIssue records table.
    This is my question
    Write a plsql block that has to display bookid, booktitle, student_name, earliest issue date and recent issue date taking the input of Student id.
    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 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Thank you,
        Bala

    Why the duplicate post?

Maybe you are looking for

  • Kuler website and Kuler extension inside application

    I saved some swatches using the Kuler website in Mykuler account. I saved them as swatch exchange files to import into Fireworks CS4. At the time I didn't realize Fireworks CS4 did read swatch exchange files. Now I have learned that Firworks CS4 has

  • Simple Encryption Code help. Why this error?

    Why does the implements Command pharse error this program out I am a beginner here so please take it easy. I know it's probably a stupid mistake. Also how would I limit the ASCII character conversion to be between 32 and 126. public class Caesar { im

  • Need help writing a recursive method

    hello, im having problems with this and its already giving me a headache!! i have to write a recursive method that receives a parameter n that prints the following: 1 12 123 1234 how would i even begin to do this...im lost

  • Error on Applescript

    Hi, i have this statment in my Applescript: move "/Users/albertoantenucci/Downloads/cccsono.rtfd" to "/Users/albertoantenucci/Dropbox/io/di tutto/ricette" and i receive the error: Can't make "/Users/albertoantenucci/Downloads/cccsono.rtfd" into refer

  • Insertar imagenes definidas por usuario

    Buenas, necesito hacer una aplicacion con Labview 8.5 donde necesito pasar imagenes como si fuera un power point, las cuales son definidas por el usuario, y obteniendo un indice para poder desarrollar una accion en cada imagen que pasa. He obtenido l