How to join three tables?

I have used this query to join three tables but it displays an error : field vbak-vbeln is unknown.
please help me out..
SELECT vbak-vbeln vbak-bstnk vbap-matnr vbap-zmeng makt-maktx
INTO CORRESPONDING FIELDs OF TABLE itab FROM vbak
inner JOIN vbap ON vbak-vbeln eq vbap-vbeln
inner JOIN makt ON vbap-matnr eq makt-matnr
WHERE vbak-bstnk = s_bstnk.

Hi mohan kumar ,
just follow the Syntax
SELECT FLD1 FLD2 FLD3 FLD4 FLD5 INTO CORRESPONDING FIELDS OF TABLE ITAB FROM TABLE1 INNER JOIN TABLE2 ON
TABLE1FLD1 = TABLE2FLD1 INNER JOIN TABLE3 ON TABLE2FLD2 = TABLE3FLD2 INNER JOIN TABL4 ON  TABLE3FLD3 = TABLE4FLD3
WHERE FLD1 = 'AA'
Hope this may be helpful.
Please reward points if found ok.
Thanks and regards,
Rajeshwar.

Similar Messages

  • How to join three tables and practical difference between 10g and 11g

    I want to know with example how to outer join three different tables in Oracle.
    Also if you have any website or reference for understand syntax or performance difference between 10g and 11g then please paste a link in.thanks!!

    Hi,
    897293 wrote:
    I want to know with example how to outer join three different tables in Oracle.The 3rd table comes into the result set the same way the 2nd one did:
    FROM           table_1  t1
    LEFT OUTER JOIN      table_2  t2  ON   ...
    LEFT OUTER JOIN      table_3  t3  ON   ...The join condition(s) for t3 can reference t1, or t2, or both.
    Also if you have any website or reference for understand syntax or performance difference between 10g and 11g then please paste a link in.thanks!!The main manuals all have "What's New" sections near the beginning. For example:
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/wnsql.htm#sthref5
    Hoek,
    We've missed you. Welcome back!

  • How to join THREE different tables into internal table using one select statement .

    How to join THREE different tables into internal table using one select statement .
    Hi experts,
    I would like to request your guidance in solving the problem of joining the data from three different database tables into one internal table
    Scenario:
    Database tables:
    SPFLI
    SFLIGHT
    SBOOK.
    Table Fields:
    SPFLI - CARRID CONNID COUNTRYFR CITYFRM COUNTRYTO CITYTO
    SFLIGHT - CARRID CONNID FLDATE SEATSMAX SEATSOCC SEATSMAX_C
    SEATSOCC_C SEATSMAX_F SEATSOCC_F
    SBOOK - CARRID CONNID CLASS
    MY INTERNAL TABLE IS IT_XX.
    Your help much appreciated.
    Thanks in advance.
    Pawan.

    Hi Pawan,
    please check below codes. hope it can help you.
    TYPES: BEGIN OF ty_xx,
            carrid     TYPE spfli-carrid   ,
            connid     TYPE spfli-connid   ,
            countryfr  TYPE spfli-countryfr,
            cityfrom   TYPE spfli-cityfrom  ,
            countryto  TYPE spfli-countryto,
            cityto     TYPE spfli-cityto   ,
            fldate     TYPE sflight-fldate ,
            seatsmax   TYPE sflight-seatsmax ,
            seatsocc   TYPE sflight-seatsocc ,
            seatsmax_b TYPE sflight-seatsmax_b,
            seatsocc_b TYPE sflight-seatsocc_b,
            seatsmax_f TYPE sflight-seatsmax_f,
            seatsocc_f TYPE sflight-seatsocc_f,
            class      TYPE sbook-class,
          END OF ty_xx,
          t_xx TYPE STANDARD TABLE OF ty_xx.
    DATA: it_xx TYPE t_xx.
    SELECT spfli~carrid
           spfli~connid
           spfli~countryfr
           spfli~cityfrom
           spfli~countryto
           spfli~cityto
           sflight~fldate
           sflight~seatsmax
           sflight~seatsocc
           sflight~seatsmax_b
           sflight~seatsocc_b
           sflight~seatsmax_f
           sflight~seatsocc_f
           sbook~class
      INTO TABLE it_xx
      FROM spfli INNER JOIN sflight
      ON spfli~carrid = sflight~carrid
      AND spfli~connid = sflight~connid
      INNER JOIN sbook
      ON spfli~carrid = sbook~carrid
      AND spfli~connid = sbook~connid.
    Thanks,
    Yawa

  • 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

  • Joining three tables

    I have to join three tables but i m getting error as given below:
    Error i m getting-
    Syntax error(missing operator) in query expression 'invoice.INVOICE_NO=inv_ent_main.INVOICE_NO INNER JOIN invrate ON invrate.INVOICE_NO=inv_ent_main.INVOICE_N'.
    My Query is-
    "select inv_ent_main.EXPORTER,inv_ent_main.INVOICE_NO,inv_ent_main.INVOICE_DATE,inv_ent_main.BALE_COUNT,inv_ent_main.TOTAL_AMOUNT,inv_ent_main.BALE_COUNT,inv_ent_main.TOTAL_PIECES,inv_ent_main.TOTAL_AREA,invoice.ORDER_NO,invoice.OTHER_REF,invoice.CONSIGN1,invoice.CONSIGN2,invoice.CONSIGN3,invoice.CONSIGN4,invoice.CONSIGN5,invoice.DLV_TERMS,invoice.PAYMENT_TERMS,invoice.PRE_CARRIAGE,invoice.PR_CARRIER,invoice.DESTINATION,invoice.COUNTRY_DESTINATION,invoice.VESS_FLIGHT,invoice.PORT_LOAD,invoice.PORT_DSCH,invoice.MARK1,invoice.MARK2,invoice.CURRENCY,invoice.GOODS_DESCRIPTION,invoice.CFB,invoice.GROSS_WEIGHT,invoice.NET_WEIGHT,invoice.WOOL,invoice.COTTON
    from inv_ent_main INNER JOIN invoice ON invoice.INVOICE_NO = inv_ent_main.INVOICE_NO INNER JOIN invrate ON invrate.INVOICE_NO = inv_ent_main.INVOICE_NO";
    MCA,LUCKNOW.

    The last character in the error message has missing "O" when compare to the actual query you have posted. Please rerun it an verify or you can try the below query. You need to post DDL for all the 3 tables so that we can test.
    select
    inv_ent_main.EXPORTER,
    inv_ent_main.INVOICE_NO,
    inv_ent_main.INVOICE_DATE,
    inv_ent_main.BALE_COUNT,
    inv_ent_main.TOTAL_AMOUNT,
    inv_ent_main.BALE_COUNT,
    inv_ent_main.TOTAL_PIECES,
    inv_ent_main.TOTAL_AREA,
    invoice.ORDER_NO,
    invoice.OTHER_REF,
    invoice.CONSIGN1,
    invoice.CONSIGN2,
    invoice.CONSIGN3,
    invoice.CONSIGN4,
    invoice.CONSIGN5,
    invoice.DLV_TERMS,
    invoice.PAYMENT_TERMS,
    invoice.PRE_CARRIAGE,
    invoice.PR_CARRIER,
    invoice.DESTINATION,
    invoice.COUNTRY_DESTINATION,
    invoice.VESS_FLIGHT,
    invoice.PORT_LOAD,
    invoice.PORT_DSCH,
    invoice.MARK1,
    invoice.MARK2,
    invoice.CURRENCY,
    invoice.GOODS_DESCRIPTION,
    invoice.CFB,
    invoice.GROSS_WEIGHT,
    invoice.NET_WEIGHT,
    invoice.WOOL,
    invoice.COTTON from inv_ent_main
    INNER JOIN invoice ON invoice.INVOICE_NO = inv_ent_main.INVOICE_NO
    INNER JOIN invrate ON invrate.INVOICE_NO = inv_ent_main.INVOICE_NO
    Regards, RSingh

  • How to join four tables in Update query??

    Please how to join four tables in a single query to update one table row??

    You can use this syntax to update. Here updation of 1 column to a constant value (50) in multiple rows in Table A based on an associated 'SOURCE' value in table B
    Table A joins to Table B based on the TableA.definition_id = TableB.Att_Def_id
    like..
    update TableA
    set value =50
    where
    TableA.definition_id = TableB.Att_Def_id
    and TABLEB.Source = 'NEWPRODUCT'

  • How to join two tables

    hi
    how to join two tables using inner join  if the first table has two primary keys and second table has 3 primary keys

    Would describe type of joins in ABAP, which might differ with other joins.
    The join syntax represents a recursively nestable join expression. A join expression consists of a left-hand and a right- hand side, which are joined either by means of INNER JOIN or LEFT OUTER JOIN. Depending on the type of join, a join expression can be either an inner (INNER) or an outer (LEFT OUTER) join. Every join expression can be enclosed in round brackets. If a join expression is used, the SELECT command circumvents SAP buffering.
    On the left-hand side, either a single database table, a view dbtab_left, or a join expression join can be specified. On the right-hand side, a single database table or a view dbtab_right as well as join conditions join_cond can be specified after ON. In this way, a maximum of 24 join expressions that join 25 database tables or views with each other can be specified after FROM.
    AS can be used to specify an alternative table name tabalias for each of the specified database table names or for every view. A database table or a view can occur multiple times within a join expression and, in this case, have various alternative names.
    The syntax of the join conditions join_cond is the same as that of the sql_cond conditions after the addition WHERE, with the following differences:
    At least one comparison must be specified after ON.
    Individual comparisons may be joined using AND only.
    All comparisons must contain a column in the database table or the view dbtab_right on the right-hand side as an operand.
    The following additions not be used: NOT, LIKE, IN.
    No sub-queries may be used.
    For outer joins, only equality comparisons (=, EQ) are possible.
    If an outer join occurs after FROM, the join condition of every join expression must contain at least one comparison between columns on the left-hand and the right-hand side.
    In outer joins, all comparisons that contain columns as operands in the database table or the view dbtab_right on the right-hand side must be specified in the corresponding join condition. In the WHERE condition of the same SELECT command, these columns are not allowed as operands.
    Resulting set for inner join
    The inner join joins the columns of every selected line on the left- hand side with the columns of all lines on the right-hand side that jointly fulfil the join_cond condition. A line in the resulting set is created for every such line on the right-hand side. The content of the column on the left-hand side may be duplicated in this case. If none of the lines on the right-hand side fulfils the join_cond condition, no line is created in the resulting set.
    Resulting set for outer join
    The outer join basically creates the same resulting set as the inner join, with the difference that at least one line is created in the resulting set for every selected line on the left-hand side, even if no line on the right-hand side fulfils the join_cond condition. The columns on the right-hand side that do not fulfil the join_cond condition are filled with null values.
    Note
    If the same column name occurs in several database tables in a join expression, they have to be identified in all remaining additions of the SELECT statement by using the column selector ~.
    Example
    Join the columns carrname, connid, fldate of the database tables scarr, spfli and sflight by means of two inner joins. A list is created of the flights from p_cityfr to p_cityto. Alternative names are used for every table.
    PARAMETERS: p_cityfr TYPE spfli-cityfrom,
    p_cityto TYPE spfli-cityto.
    DATA: BEGIN OF wa,
    fldate TYPE sflight-fldate,
    carrname TYPE scarr-carrname,
    connid TYPE spfli-connid,
    END OF wa.
    DATA itab LIKE SORTED TABLE OF wa
    WITH UNIQUE KEY fldate carrname connid.
    SELECT ccarrname pconnid f~fldate
    INTO CORRESPONDING FIELDS OF TABLE itab
    FROM ( ( scarr AS c
    INNER JOIN spfli AS p ON pcarrid = ccarrid
    AND p~cityfrom = p_cityfr
    AND p~cityto = p_cityto )
    INNER JOIN sflight AS f ON fcarrid = pcarrid
    AND fconnid = pconnid ).
    LOOP AT itab INTO wa.
    WRITE: / wa-fldate, wa-carrname, wa-connid.
    ENDLOOP.
    Example
    Join the columns carrid, carrname and connid of the database tables scarr and spfli using an outer join. The column connid is set to the null value for all flights that do not fly from p_cityfr. This null value is then converted to the appropriate initial value when it is transferred to the assigned data object. The LOOP returns all airlines that do not fly from p_cityfr.
    PARAMETERS p_cityfr TYPE spfli-cityfrom.
    DATA: BEGIN OF wa,
    carrid TYPE scarr-carrid,
    carrname TYPE scarr-carrname,
    connid TYPE spfli-connid,
    END OF wa,
    itab LIKE SORTED TABLE OF wa
    WITH NON-UNIQUE KEY carrid.
    SELECT scarrid scarrname p~connid
    INTO CORRESPONDING FIELDS OF TABLE itab
    FROM scarr AS s
    LEFT OUTER JOIN spfli AS p ON scarrid = pcarrid
    AND p~cityfrom = p_cityfr.
    LOOP AT itab INTO wa.
    IF wa-connid = '0000'.
    WRITE: / wa-carrid, wa-carrname.
    ENDIF.
    ENDLOOP.

  • How to join three dimension tables

    I have one seperate schema, which consists of only 3 tables(all three tables has dimension fields and fact fields(dim fields =textual fields,fact fields=measures))
    How to handle this type of situation in RPD.
    Ex: table A,Table b,Table c
    Table A needs to join with Table b on many to one relationship.
    Table c needs to join with table b on many to one relationship.
    Anyone suggest me what is the best way to handle this type of situation.do I require to create dimensional hierarchies for all three tables? Or can I consider only table b as dimension and remaining 2 consider as fact?

    This will not be possible. As per dimensional modelling atleast you should have one fact table.
    Dimensional tables can be joined to one another if the have flakes(sightly normalized table).
    so you have start up the things from DWH.
    Regards,
    Kishore.

  • Getting no result by joining three tables in BMM

    Hi all,
    I have a requirement where I have a fact table and two ailas dimension table.
    Let say fact is w_account_f and dimension ailas dim_w_account_d_trans and dim_w_account_d_sal of w_account_d table
    I have join in physical layer
    w_account_f ----> dim_w_account_d_trans with forgin key join
    w_account_f ----> dim_w_account_d_sal with forgin key join
    In BMM i have join these three table but given content level filter in dimension like
    dim_w_account_d_trans.tans_col = 'active'
    dim_w_account_d_sal.sal > 4000
    when i am trying to pull the report from all three table
    w_account_f, dim_w_account_d_trans, dim_w_account_d_sal
    its not giving any result where as when i trying to pull report with fact any one dimension its giving me result.
    can anyone help me in finding the soulting how to get the data by joining all these three tables.

    Hi,
    Take the physical query with all three tables selected. Run the query in sql developer, remove the joins one by one and check where it fails. Modify the rpd model accordingly.
    Regards,
    Dpka

  • Joining Three Tables with multiple record

    Dear All
    we need some help. We have Three Tables in sqlserver2012
    Master Table
    OrderID       PackageID      CustomerName
    1                          1               Abc
    2                          2                Bcd
    3                          1                xyz
    Child1 Table
    OrderID          ControlName
    1                   Row1COlumn1             (It Means Pant in Red Color is selected by user(relation with Child2 Table))
    1                   Row3Column1             (It Means Gown in Blue Color is selected by user(relation with Child2 Table))
    1                   Row4Column3             (It Means T Shirt in White Color is selected by user(relation with Child2 Table))
    2                    Row1Column2            (It Means Tie in Green Color is selected by user(relation with Child2 Table))
    2                   Row3Column1            (It Means Bow in Red Color is selected by user(relation with Child2 Table))
    Child2 Table
    PackageID      Product      Color1     Color2    Color3
    1                       Pant        Red          Green     Blue    
    1                       Shirt        Blue      Pink    Purple
    1                       Gown         Blue      Black    Yellow
    1                       T Shirt     Red          Green     White
    2                       Tie         Red          Green     White
    2                       Socks       Red          Green     White
    2                       Bow         Red          Green     White
    We want to have result like
    OrderID    PackageID      CustomerName   Pant    Gown  T Shirt     Tie         Bow  
    1                     1                 ABC               Red     Blue    White      x    
          x
                                                                   Blue
    2                      2                 Bcd                 x         x          x
           Green      Red
    I have tried 
    ;with mycte as (
    select  ms.OrderID,ms.PackageID
    ,ms.CustomerName
    , Replace(stuff([ControlName], charindex('Column',ControlName),len(ControlName),''),'Row','')  rowNum 
    ,Replace(stuff([ControlName], 1, charindex('Column',ControlName)-1 ,''),'Column','') columnNum 
    From  child1 c inner join MasterTable ms on c.Orderid=ms.orderid)
    ,mycte1 as (
    select *, row_number() Over(Partition By PackageID Order By Child2ID) rn from child2
    ,mycte2 as (
    Select m.OrderID,m.PackageID, m.CustomerName, m.ColumnNum,  m1.Product 
    --,m1.Color1 , m1.Color2, m1.Color3 
    , Case WHEN ColumnNum= 1 Then Color1 
     WHEN ColumnNum= 1 Then Color1 
      WHEN ColumnNum= 2 Then Color2 
       WHEN ColumnNum= 3 Then Color3 End Colors  
    from mycte m 
    join mycte1 m1 on m.rowNum=m1.rn and m.PackageID=m1.PackageID)
    Select OrderID,PackageID,CustomerName, ISNULL(Max(Case WHen Product='Pant' Then Colors END),'X') as 'Pant'
    , ISNULL(Max(Case WHen Product='Gown' Then Colors END),'X') as 'Gown'
    , ISNULL(Max(Case WHen Product='T Shirt' Then Colors END),'X') as 'T Shirt'
    , ISNULL(Max(Case WHen Product='Tie' Then Colors END),'X') as 'Tie'
    , ISNULL(Max(Case WHen Product='Bow' Then Colors END),'X') as 'Bow'
    FROM mycte2
     Group by OrderID,PackageID, CustomerName
    it works if we have a product in one color only. like if we have pant in red and blue then its showing just first record
    Thanks and Best Regards Umair

    Are you really storing textual values like "Row3Column1" or "Row4Column3"???
    Your model is a mess. Redesign it.. btw, these kind of models are quite complex.
    USE tempdb;
    GO
    CREATE TABLE dbo.Colors
    ColorID INT NOT NULL ,
    ColorName NVARCHAR(255) NOT NULL ,
    CONSTRAINT PK_Colors PRIMARY KEY ( ColorID )
    CREATE TABLE dbo.Products
    ProductID INT NOT NULL ,
    ProductName NVARCHAR(255) NOT NULL ,
    CONSTRAINT PK_Products PRIMARY KEY ( ProductID ) ,
    CONSTRAINT UQ_Products_ProductName UNIQUE ( ProductName )
    CREATE TABLE dbo.Packages
    PackageID INT NOT NULL ,
    CONSTRAINT PK_Packages PRIMARY KEY ( PackageID )
    CREATE TABLE dbo.PackageDetails
    ColorID INT NOT NULL ,
    PackageID INT NOT NULL ,
    ProductID INT NOT NULL ,
    CONSTRAINT PK_PackageDetails PRIMARY KEY ( ColorID, PackageID, ProductID ) ,
    CONSTRAINT FK_PackageDetails_ColorID FOREIGN KEY ( ColorID ) REFERENCES dbo.Colors ( ColorID ) ,
    CONSTRAINT FK_PackageDetails_PackageID FOREIGN KEY ( PackageID ) REFERENCES dbo.Packages ( PackageID ) ,
    CONSTRAINT FK_PackageDetails_ProductID FOREIGN KEY ( ProductID ) REFERENCES dbo.Products ( ProductID )
    CREATE TABLE dbo.Orders
    OrderID INT NOT NULL ,
    CustomerID INT NOT NULL ,
    PackageID INT NOT NULL ,
    CONSTRAINT PK_Orders PRIMARY KEY ( OrderID ) ,
    CONSTRAINT UQ_Orders_CustomerID UNIQUE ( OrderID, PackageID ) ,
    CONSTRAINT FK_Orders_PackageID FOREIGN KEY ( PackageID ) REFERENCES dbo.Packages ( PackageID )
    CREATE TABLE dbo.OrderDetails
    ColorID INT NOT NULL ,
    OrderID INT NOT NULL ,
    PackageID INT NOT NULL ,
    ProductID INT NOT NULL ,
    CONSTRAINT FK_OrderDetails_Orders FOREIGN KEY ( OrderID, PackageID ) REFERENCES dbo.Orders ( OrderID, PackageID ) ,
    CONSTRAINT FK_OrderDetails_PackageDetails FOREIGN KEY ( ColorID, PackageID, ProductID ) REFERENCES dbo.PackageDetails ( ColorID, PackageID, ProductID )
    GO
    INSERT INTO dbo.Colors
    ( ColorID, ColorName )
    VALUES ( 1, 'Red' ),
    ( 2, 'Green' ),
    ( 3, 'Blue' ),
    ( 4, 'Pink' ),
    ( 5, 'Purple' ),
    ( 6, 'Black' ),
    ( 7, 'Yellow' ),
    ( 8, 'White' );
    INSERT INTO dbo.Products
    ( ProductID, ProductName )
    VALUES ( 1, 'Pant' ) ,
    ( 2, 'Shirt' ) ,
    ( 3, 'Gown' ) ,
    ( 4, 'T Shirt' ) ,
    ( 5, 'Tie' ) ,
    ( 6, 'Socks' ) ,
    ( 7, 'Bow' );
    INSERT INTO dbo.Packages
    ( PackageID )
    VALUES ( 1 ),
    ( 2 );
    INSERT INTO dbo.PackageDetails
    ( PackageID, ProductID, ColorID )
    VALUES ( 1, 1, 1 ),
    ( 1, 2, 3 ),
    ( 1, 3, 3 ),
    ( 1, 4, 1 ),
    ( 2, 5, 1 ),
    ( 2, 6, 1 ),
    ( 2, 7, 1 ),
    ( 1, 1, 2 ),
    ( 1, 2, 4 ),
    ( 1, 3, 6 ),
    ( 1, 4, 2 ),
    ( 2, 5, 2 ),
    ( 2, 6, 2 ),
    ( 2, 7, 2 ),
    ( 1, 1, 3 ),
    ( 1, 2, 5 ),
    ( 1, 3, 7 ),
    ( 1, 4, 8 ),
    ( 2, 5, 8 ),
    ( 2, 6, 8 ),
    ( 2, 7, 8 );
    INSERT INTO dbo.Orders
    ( OrderID, PackageID, CustomerID )
    VALUES ( 1, 1, 1 ),
    ( 2, 2, 2 ),
    ( 3, 1, 3 );
    INSERT INTO dbo.OrderDetails
    ( ColorID, OrderID, PackageID, ProductID )
    VALUES ( 1, 1, 1, 1 ),
    ( 3, 1, 1, 3 ),
    ( 8, 1, 1, 4 ),
    ( 2, 2, 2, 5 ),
    ( 1, 2, 2, 7 );
    GO
    SELECT *
    FROM dbo.Orders O
    INNER JOIN dbo.OrderDetails OD ON OD.OrderID = O.OrderID
    INNER JOIN dbo.Products P ON P.ProductID = OD.ProductID
    INNER JOIN dbo.Colors C ON C.ColorID = OD.ColorID;
    GO
    DROP TABLE dbo.OrderDetails;
    DROP TABLE dbo.Orders;
    DROP TABLE dbo.PackageDetails;
    DROP TABLE dbo.Packages;
    DROP TABLE dbo.Products;
    DROP TABLE dbo.Colors;
    GO

  • How to save three table control in subscreen from main screen

    hi All,
    I have three table control in subscreen and i want to save the content of all the table control from the save button of Main screen how can i do it.
    Thanks
    Narendra Vikram Vishwakarma

    hi
    in main screen PAI
    when 'SAVE'
    write the code here to save it.
    thanks

  • How to Join 2 tables if datetime diff is within range?

    Hi, problem figuring out how to join tables if the datediff ? is within range.  
    There are 3 tables  a main table then 2 sub tables, these are measurements with a date/time value.  Im trying to take the datetime entries from the 2 sub tables and match them, then add  them to the main table
    subtable1 has SampleID, datetime, 
    subtable2 has TesterID, datetime
    maintable has SampleID, datetime, TesterID, datetime
    so the maintable would always have the sampleID value and datetime regardless.  but it would only JOIN the testerID and its datetime, only IF these 2 datetime values were close, and the datediff interval was set to 1 second.
     its a function call that fills the main tables matching columns but only if the testerIDs datetime is close to the sampleIDs time????
    thanks

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
    use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. Thanks for making us do your typing and DDL for you :( 
    >> There are 3 tables; a main table then 2 sub tables, <<
    Really? Main table? Sub-tables? There are no such terms in SQL. Trust me on that; I helped with the Standards :) We have referenced referencing tables in the DRI model of SQL. 
    >> these are measurements with a date/time value. << 
    ++Both of them, the measurementID and otherID  have a millisecond timestamp, the goal is to associate these 2 measurements, they are coming from different systems.  
    Do you really need the full timestamp down to nanoseconds and not just a DATE? Oh, we also have no sample data :( So we have to guess at precision, constraints, keys, etc. 
    See why we need DDL? Is this relationship 1:1, 1:M OR N:1? My guess is that a tester can do many samples, but a sample has only one tester. And what were those two timestamps? Not redundant copies from the referenced tables!! That would non-normalized. 
    >> so the Sample_Tester_Relationship would always have the sample_nbr value and <something>_timestamp regardless. But it would only JOIN the tester_id and its DATETIME, only IF these 2 DATETIME values were close, and the DATEDIFF interval was set
    to 1 second. <<
    No, you do not do a JOIN inside a base table. That is VIEW.
    >> It is a function [sic: procedure, Functions return scalar values] call that fills the main tables matching columns but only if the tester_id DATETIME is close to the sample_id time? <<
    No sample data, no sample code and no business rules about ties. Here is my final guess at normalizing this problem: 
    CREATE TABLE Samples
    (sample_nbr CHAR(12) NOT NULL PRIMARY KEY,
    CREATE TABLE Testers
    (tester_id CHAR(10) NOT NULL PRIMARY KEY,
    CREATE TABLE Sample_Tester_Relationship --- needs a real name!
    (sample_nbr CHAR(12) NOT NULL PRIMARY KEY
     REFERENCES Samples
      ON UPDATE CASCADE
      ON DELETE CASCADE,
     tester_id CHAR(10) NOT NULL
     REFERENCES Testers
      ON UPDATE CASCADE
      ON DELETE CASCADE,
     PRIMARY KEY (sample_nbr, tester_id),
     tester_timestamp DATETIME2(1) DEFAULT CURRENT_TIMESTAMP NOT NULL,
     sample_timestamp DATETIME2(1) DEFAULT CURRENT_TIMESTAMP NOT NULL,
     CHECK (ABS (DATEDIFF (SECOND, tester_timestamp, sample_timestamp) <= 1) );
    Most of the work in SQL is in DDL, not DML. 
    I will try this out and advise.
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking in
    Sets / Trees and Hierarchies in SQL
    Dear Celko
    thank you for this constructive feedback, clearly you're an expert and I am going to be better for following this advice.  In the 1970s I was told to avoid going into software because Japan had invented a way for computers to write their own code, so
    programmers would be out of a job and the field would be a dead-end.  I didnt formally begin training in sw until the 90s.  SQL is one of those last frontiers i never trained in.  but now Im trying to learn and find anything i can read to absorb
    it.
    I posted in laymans words because i thought thats how you experts would prefer it described, clearly not.  I will now take the time to read each reference to the standards...

  • How to join two tables using EJB-QL

    Hi There,
    How to join tables using EJB-QL ?
    Thanks.
    Edited by: vamseebobby on Nov 6, 2007 8:12 AM

    You might try
    SELECT b.entity2property FROM Entity1 a JOIN a.entity2 b
    for example, to retrieve players names, from a Players table, that belong to the team 'My Team' in the Teams table
    SELECT b.playerName FROM Teams a JOIN a.players b WHERE a.teamName = 'My Team'

  • How to join cluster table?

    How to join the cluster table with the transparent table?In specific ,can you pls tell me how can i join bkpf and bseg?

    Hi Aravind,
    Check this code,
    tables : bkpf,
             bseg.
       INTERNAL TABLE AND WORK AREA FOR THE FIELDS IN BKPF TABLE         *
    data : begin of itab_bkpf occurs 0,
           bukrs like bkpf-bukrs,            "Company Code.
           gjahr like bkpf-gjahr,            "Fiscal Year.
           budat like bkpf-budat,            "Posting Date in the Document.
           belnr like bkpf-belnr,            "Accounting document number.
           blart like bkpf-blart,            "Document Type.
           end of itab_bkpf.
    data : wa_bkpf like line of itab_bkpf.
       INTERNAL TABLE AND WORK AREA FOR THE FIEDLS IN BSEG TABLE         *
    data : begin of itab_bseg_debit occurs 0,
           bukrs like bseg-bukrs,            "Company Code.
           gjahr like bseg-gjahr,            "Fiscal Year.
           belnr like bseg-belnr,            "Accounting Document Number.
           buzei like bseg-buzei,            "Line Item.
           hkont like bseg-hkont,            "General Leadger Account.
           shkzg like bseg-shkzg,            "Credit/Debit Indicator.
           wrbtr like bseg-wrbtr,            "Amount in Document Currency.
           pswsl like bseg-pswsl,            "Update Currency for Gen.Ledger
           dmbtr like bseg-dmbtr,            "Amount in local currency.
           sgtxt like bseg-sgtxt,            "Item Text.
           zuonr like bseg-zuonr,            "Assignment Number.
           end of itab_bseg_debit.
    data : itab_bseg_credit like standard table of itab_bseg_debit with
           header line.
                      FINAL OUTPUT INTERNAL TABLE                        *
    data : begin of itab_output occurs 0,
           belnr(08)            ,
           bukrs(04)            ,
           budat like bkpf-budat,
           buzei(03)            ,
           hkont(07)            ,
           blart(02)            ,
           shkzg(01)            ,
           wrbtr(08)            ,
           pswsl(05)            ,
           dmbtr(10)            ,
           sgtxt(19)            ,
           zuonr(10)            ,
    end of itab_output.
    constants : c_debit  type c value 'S',
                c_credit type c value 'H'.
                               SELECT-OPTIONS                            *
    selection-screen begin of block input with frame title text-t01.
    select-options : s_bukrs for bkpf-bukrs.
    parameters     : p_year like bkpf-gjahr visible length 2.
    select-options : s_budat  for bkpf-budat,
                     s_dbacct for bseg-hkont,
                     s_cracct for bseg-hkont,
                     s_amt    for bseg-dmbtr.
    selection-screen end of block input.
         SELECTING RECORDS FROM BKPF TABLE BASED ON THE CONDITION        *
    select bukrs gjahr budat belnr blart
           from  bkpf into table itab_bkpf
           where bukrs in s_bukrs and
                 gjahr eq p_year  and
                 budat in s_budat.
        SELECTING DEBIT LINE ITEMITEMS FROM BSEG FOR THE DOCUMENT        *
                      NUMBER SELECTED FROM BKPF                          *
    if not itab_bkpf[] is initial.
      select bukrs gjahr belnr buzei
             hkont shkzg wrbtr pswsl
             dmbtr sgtxt zuonr
             from bseg into table itab_bseg_debit
             for all entries in itab_bkpf
             where bukrs eq itab_bkpf-bukrs and
                   belnr eq itab_bkpf-belnr and
                   gjahr eq itab_bkpf-gjahr and
                   hkont in s_dbacct        and
                   shkzg eq c_debit         and
                   dmbtr in s_amt.
        SELECTING CREDIT LINE ITEMITEMS FROM BSEG FOR THE DOCUMENT       *
                      NUMBER SELECTED FROM BKPF                          *
      select bukrs gjahr belnr buzei
             hkont shkzg wrbtr pswsl
             dmbtr sgtxt zuonr
             from bseg into table itab_bseg_credit
             for all entries in itab_bkpf
             where bukrs eq itab_bkpf-bukrs and
                   belnr eq itab_bkpf-belnr and
                   gjahr eq itab_bkpf-gjahr and
                   hkont in s_cracct        and
                   shkzg eq c_credit        and
                   dmbtr in s_amt.
    endif.
    sort itab_bkpf        by bukrs gjahr belnr.
    sort itab_bseg_credit by bukrs gjahr belnr.
                         LOOPING THE DEBIT ENTRIES                       *
    loop at itab_bseg_debit.
    READING THE CREDIT ENTRIES WHICH MATCHES WITH HE CURRENT DOC. NUMBER *
      read table itab_bseg_credit with key
                 bukrs = itab_bseg_debit-bukrs
                 gjahr = itab_bseg_debit-gjahr
                 belnr = itab_bseg_debit-belnr binary search.
      if sy-subrc eq 0.
    *READING THE POSTING DATE AND DOCUMENT TYPE FOR THE CURRENT DOUCMENT   *
           AND APPENDING THE DEBIT AND CREDIT ENTRIES                    *
        read table itab_bkpf into wa_bkpf with key
                   bukrs = itab_bseg_debit-bukrs
                   gjahr = itab_bseg_debit-gjahr
                   belnr = itab_bseg_debit-belnr binary search.
        itab_output-belnr = itab_bseg_debit-belnr.
        itab_output-bukrs = itab_bseg_debit-bukrs.
        itab_output-budat = wa_bkpf-budat.
        itab_output-buzei = itab_bseg_debit-buzei.
        itab_output-hkont = itab_bseg_debit-hkont.
        itab_output-blart = wa_bkpf-blart.
        itab_output-shkzg = itab_bseg_debit-shkzg.
        itab_output-wrbtr = itab_bseg_debit-wrbtr.
        itab_output-pswsl = itab_bseg_debit-pswsl.
        itab_output-dmbtr = itab_bseg_debit-dmbtr.
        itab_output-sgtxt = itab_bseg_debit-sgtxt.
        itab_output-zuonr = itab_bseg_debit-zuonr.
        append itab_output.
        itab_output-belnr = itab_bseg_credit-belnr.
        itab_output-bukrs = itab_bseg_credit-bukrs.
        itab_output-budat = wa_bkpf-budat.
        itab_output-buzei = itab_bseg_credit-buzei.
        itab_output-hkont = itab_bseg_credit-hkont.
        itab_output-blart = wa_bkpf-blart.
        itab_output-shkzg = itab_bseg_credit-shkzg.
        itab_output-wrbtr = itab_bseg_credit-wrbtr.
        itab_output-pswsl = itab_bseg_credit-pswsl.
        itab_output-dmbtr = itab_bseg_credit-dmbtr.
        itab_output-sgtxt = itab_bseg_credit-sgtxt.
        itab_output-zuonr = itab_bseg_credit-zuonr.
        append itab_output.
      endif.
    endloop.
    sort itab_output by belnr budat shkzg.
                     LOOPING OUTPUT INTERNAL TABLE                       *
    *FORMAT INTENSIFIED INPUT.
    *FORMAT INVERSE ON.
    loop at itab_output.
      format hotspot on.
      format color 5 inverse.
      write :/  sy-vline,
               000 itab_output-belnr, 12  sy-vline,
               013 itab_output-bukrs, 17  sy-vline,
               019 itab_output-budat,     sy-vline,
               034 itab_output-buzei, 40  sy-vline,
               042 itab_output-hkont,     sy-vline,
               054 itab_output-blart, 60  sy-vline,
               065 itab_output-shkzg, 70  sy-vline,
               072 itab_output-wrbtr,     sy-vline,
               085 itab_output-pswsl,     sy-vline,
               093 itab_output-dmbtr,     sy-vline,
               106 itab_output-sgtxt,     sy-vline,
                   itab_output-zuonr,     sy-vline.
      format hotspot off.
    endloop.
    uline 0(139).
    <b>Regards,
    Jackie.</b>

  • SQL Join Three Tables DW MX2004 ASP

    I'm trying to display records using three tables joined as
    shown in the SQL code below. I'm getting "no data" message when I
    test the result page from the search form. I'm using the advanced
    Dreamweaver form to enter the SQL commands. I have never used this
    feature of Dreamweaver before and I'm not sure if the code below
    follows the way DW MX will understand what I'm trying to do. Below
    is the code based on Standard SQL....not sure if DW compatible...
    This is what I typed in the SQL box:
    SELECT
    ResourceSkillMapping.resourceSkillMapID,ResourceSkillMapping.skillID,
    ResourceSkillMapping.competenceLevel,skill.skillname,resource.resourceName,resource.resour ceLoginId
    FROM ResourceSkillMapping INNER JOIN Skill ON
    ResourceSkillMapping.skillID = Skill.skillID
    INNER JOIN Resource ON
    ResourceSkillMapping.resourceSkillMapID =
    Resource.resourceSkillMapID
    WHERE (Skill.skillName = '%Skill_asp%') AND
    (Resource.resourceLoginID = '%Agent_asp%')
    AND (Resource.active = 1)
    These is typed in the variables box:
    Variable Default Runtime
    Skill_asp 1 Request.QueryString("skillname")
    Agent_asp 1 Request.QueryString("resourceLoginID")
    I'm using asp and the "Get" url parameters in the search form
    calling the result recordset in DW. I'm connecting to a SQL 2000
    server. Is this notation DW correct? Am I joining the tables
    correctly. The tables are ResourceSkillMapping, Skill and Resource.
    All I need is to be able to search by ResourceLoginID and by
    skillName on all active records (active=1). The plan is to be able
    to click on a result record and go to a detail page to update the
    "CompetencyLevel" field in the resourceSkillMapping table using the
    update behavior in DW.
    Please help as this project is due this Tue and have been
    trying every posibility I could think so far....I have read all the
    DW help facilities many pages on this and still keep getting the
    "no data" message
    Thank you,
    Carlos
    [email protected]

    >> WHERE (Skill.skillName = '%Skill_asp%') AND
    (Resource.resourceLoginID =
    >>'%Agent_asp%')
    I would say that this is where your problem is. Change it to:
    WHERE (Skill.skillName LIKE '%Skill_asp%') AND
    (Resource.resourceLoginID
    LIKE
    '%Agent_asp%')
    and your query should work, unless of course you are actually
    searching for
    2 strings that read %Skill_asp% and %Agent_asp% exactly.
    Pat.
    "ITCoreTeam" <[email protected]> wrote in
    message
    news:[email protected]...
    > I'm trying to display records using three tables joined
    as shown in the
    > SQL
    > code below. I'm getting "no data" message when I test
    the result page from
    > the
    > search form. I'm using the advanced Dreamweaver form to
    enter the SQL
    > commands.
    > I have never used this feature of Dreamweaver before and
    I'm not sure if
    > the
    > code below follows the way DW MX will understand what
    I'm trying to do.
    > Below
    > is the code based on Standard SQL....not sure if DW
    compatible...
    > This is what I typed in the SQL box:
    >
    > SELECT
    >
    ResourceSkillMapping.resourceSkillMapID,ResourceSkillMapping.skillID,
    >
    >
    ResourceSkillMapping.competenceLevel,skill.skillname,resource.resourceName,resou
    > rce.resourceLoginId
    > FROM ResourceSkillMapping INNER JOIN Skill ON
    ResourceSkillMapping.skillID
    > =
    > Skill.skillID
    > INNER JOIN Resource ON
    ResourceSkillMapping.resourceSkillMapID =
    > Resource.resourceSkillMapID
    > WHERE (Skill.skillName = '%Skill_asp%') AND
    (Resource.resourceLoginID =
    > '%Agent_asp%')
    > AND (Resource.active = 1)
    >
    > These is typed in the variables box:
    > Variable Default Runtime
    > Skill_asp 1 Request.QueryString("skillname")
    > Agent_asp 1 Request.QueryString("resourceLoginID")
    >
    > I'm using asp and the "Get" url parameters in the search
    form calling the
    > result recordset in DW. I'm connecting to a SQL 2000
    server. Is this
    > notation
    > DW correct? Am I joining the tables correctly. The
    tables are
    > ResourceSkillMapping, Skill and Resource. All I need is
    to be able to
    > search by
    > ResourceLoginID and by skillName on all active records
    (active=1). The
    > plan is
    > to be able to click on a result record and go to a
    detail page to update
    > the
    > "CompetencyLevel" field in the resourceSkillMapping
    table using the update
    > behavior in DW.
    > Please help as this project is due this Tue and have
    been trying every
    > posibility I could think so far....I have read all the
    DW help facilities
    > many
    > pages on this and still keep getting the "no data"
    message
    > Thank you,
    > Carlos
    > [email protected]
    >

Maybe you are looking for

  • File Load is not working on Mac but Windows

    Hi i'm developing an app which simply load files (images and sounds) and uses binary data. Application is working fine on Windows, but it raises error on Mac. Now i dont own Mac so i cant debug it, I also googled but couldnt find anything close to it

  • Combining Workflows in Automator

    I am trying to figure out if there is a way to combine workflows in Apple's Automator application. Basically I saved out the automation as an application and it works like this: I can drag a folder of images onto it and it scales and renames them. At

  • Dynamically changing elements in an array of menu ring controls

    I have an array (32 rows, 5 columns) of menu ring controls.  When a menu selection is made in the first column of any given row, the contents of the menu ring for the subsequent columns (same row) may change.  If this is possible, how would you do it

  • UDV Syntax Issue

    Hello Experts, The following UDV code works until I add the WHERE clause, at which time I get a syntax error near keyword WHERE: DECLARE @x INTEGER SET @x = $[$3.2.NUMBER] WHERE $[$3.1.0] = 'Mileage' SELECT CASE WHEN @x BETWEEN 1 AND 19 THEN 10 WHEN

  • Photoshop CS6 has quit working, the program will now close.

    Recently after installing adobe flash pro CS6 (It didnt work -.- just said i didnt have permissiosn or the file was missing) My photoshop CS6 and After effects CS4 just quit when I run them. I cant seem to find a fix for this. I even did a system res