combining two tables

Hello

I have a while loop that runs trough each case in a box structure. Each of these cases produced a 1 d table. How can I combine these tables in a 2d array. An attempt with two cases is attempted in the attached diagram.

The problem is it seems to fill the first column with zeroes when you add the second row in table

Hi Jagwa,

first: use a registry to offset instead of tunnels. In this way, the result of the first iteration is not lost in the 2nd

"It seems to fill the first column with zeroes" - no, just the table of origin once again, but now by replacing the second row!

2nd:

When your loop runs twice, all the time why not use a FOR loop instead? No need to check for "I".<>

Tags: NI Software

Similar Questions

  • Combine two tables 1 d in a 2D array

    Hi all

    Maybe I forget what is obvious, but I can't find a solution to combine two tables 1 d in a 2D array AND (it is the impossible part for me) using the tables columns instead of lines.

    Example:

    Table 1:1, 2, 3, 4

    Table 2:5, 6, 7, 8

    Result: 1, 5

    2, 6

    3, 7

    4, 8

    The 'build array' function seems to add all tables as lines... I guess I could transpose the table, but I want it runs in a Subvi in constructions of different loop and I feel a little uncomfortable with it - I guess one would be left with a completely mixed table. I was maybe blind just to find the right function?

    Cheers, Jessi

    Hi Jessi,

    by default, LV is combining tables in rows. So when you need columns you must transpose the sets or use a different indexing scheme...

  • Query combining two tables

    I have the following two tables:

    Asset_Issued

    Asset_Type_IDAssigned to
    1RAM
    2RAM
    3RAM
    4RAM
    5RAM
    1Riadh
    3Riadh
    5Riadh
    1Rajesh
    3Rajesh
    2Rajesh

    Asset_Type

    Asset_Type_IDAsset_Name
    1Laptop
    2Desktop
    3Mouse
    4Keyboard
    5Monitor

    Can someone help me with the query that will give the following result.

    Asset_Issued_Count

    Asset_NameCounty
    Laptop3
    Desktop2
    Mouse3
    Keyboard1
    Monitor1

    Really? It's really basic things.

    Select at.asset_name, count (*)

    of asset_type to

    Join asset_issued HERE on (ai.asset_type_id = at.asset_type_id)

    At.asset_name group;

  • How to combine two tables: table of origin and its values of interpolation table

    We get a new array of values after using the interpolation on a table function in labview, but how to combine the array of values and this original interpolated set of values in a single table?


  • Want to combine two tables with different numbers of lines 2d

    I'm out data in a file in 2d tables, then adding more as it goes, and I run into issues when the size changes.

    2D arrays must be of rectangular shape, so those empty space you have it will be filled with the default value of any data type you are using. See attachment for the concatenation of tables:

  • Combine two tables using Actionscript Flex Applications errors

    Hello

    I have a set of Actionscript code below that I would run based on a query and have it display what are all of the selections that I posted from the checkbox elements two repeater.

    This doesn't seem to work every time when I get to the checkBox_change2 function. I still see some error messages popping up telling me that I have references null to that particular line: var selArr3:Array = selArr2.concat (selArr);

    Could someone tell me how I can get checkBox_change2() don't forget the selections, I did in checkBox_change()? I tried to use public var for the [Bindable] above but I still get the same error.

    Thanks in advance.

    Alice

    You are declaring your selArr not always correctly.
    The statement [Bindable] private var selArr:Array; is an instance variable. It is defined outside of any function and is visible from almost anything in your object.

    In your service
    private void checkBox_change(evt:Event,x:Array):void {}
    selArr:Array = [];

    selArr is defined as a local variable that is visible only in the function checkBox_change. Because the names are the same that you override the instance variable. (In reality this is not compiling correctly... your first try for var selArr:Array = [] was the valid syntax for the variable substitution)

    To remedy this, you just need to change
    selArr:Array = [] in selArr = [];

  • combine two daq physical channels in a single task

    Hi all!

    I use a PCI-6120 with a BNC-2120 to generate two signals: one is used to control an optical device which must be characterized, and the other signal is sent to a digital video camera to trigger the acquisition so that it is synchronized with the first signal. Everything is controlled with Labview.

    I want to give the possibility to the user to choose which channel to use for the first signal and channel to use for the second signal, depending on how the devices connected to the BNC-2120. So I would like to put two different "physical channel" screws on the Labview command window.

    My question is:

    What I need to create two different tasks to the signals to be generated on the appropriate channel, or can I combine two channels (and how?) think I handle only a single task to two channels always but do not forget that each signal is generated on the corerct channel, depending on the channel selected for each of the two signals...?

    Thanks a lot for your answers.

    Nice day.

    Luke

    Hi LucG,

    If you use only a single Council to create only a single task for two generations.

    You can choose several channels by clicking on "Restaurants" in the channel control physical choice multiple channels thanks ctr + click, or by concatenating multiple channels with a comma as on arrival at the VI.

    Then, when you provide data to the VI of writing, the data should be organized in a table, each channel is on a line and the order of the channels is the same as in the control of the physical channels.

    I hope this can help!

    Thank you

  • Select the data in two tables

    Hello

    I am trying to build a query WITH, but I can't seem to make it work:

    WITH P1 AS (SELECT OT_VALUE

    OF CSD_OPEN_VERY_HIGH_INCIDENTS VHIGH

    WHERE OT_VALUE > = 0

    ). P2 AS (SELECT OT_VALUE

    OF HIGH CSD_OPEN_HIGH_INCIDENTS

    WHERE OT_VALUE > = 0

    ), SELECT VHIGH. OT_VALUE, TOP. OT_VALUE

    P1 P2 JOIN INTERNALLY. RATING = P2. RANKING

    The two tables have the same column names.

    I want to only return a set of results if the two columns (OT_VALUE) contain in reality 1.

    Select this check box. This is a job for all four images. This will return the line to the following combinations. 0.0 and 0.1 and 1.0 and 1.1. Importance is 1.2.  Let me know if you face any problem

    SELECT CASE WHEN ((VH_OT_VAL = 0 ET H_OT_VAL = 0) OR (VH_OT_VAL = 1 AND H_OT_VAL = 0) OR (VH_OT_VAL = 0 AND H_OT_VAL = 1) or (VH_OT_VAL = 1 AND H_OT_VAL = 1)) 1

    ANOTHER ACE OF NULL TERMINATOR OT_VAL

    DE)

    SELECT H.OT_VALUE H_OT_VAL,

    VH. OT_VALUE VH_OT_VAL

    OF CSD_OPEN_VERY_HIGH_INCIDENTS VH.

    CSD_OPEN_HIGH_INCIDENTS H

    WHERE NVL (VH. CLASSIFICATION, 0) = NVL(H.CLASSIFICATION,0)

    AND VH. IMPORTANCE IN (1,2)

    AND H.IMPORTANCE IN (1,2)

    AND NVL (VH. OT_GROUP, 0) = NVL(H.OT_GROUP,0)

    AND VH. IMPORTANCE = H.IMPORTANCE

    AND VH. TIME_STAMP = H.TIME_STAMP

    );

  • Left join of the two tables and multiple values into a single value separated by commas

    Hello

    I have following tables with their structures and their data as below.

    CREATE TABLE 'BETODI '. "" BETINFO ".

    (

    VARCHAR2 (8 BYTE) "CURRENTPRESS."

    ENABLE 'TYPEIDCONTAINER' VARCHAR2 (30 BYTE) NOT NULL

    )

    INSERT INTO Betinfo (Currentpress, typeidcontainer) VALUES ('A24G', 'PMC');

    INSERT INTO Betinfo (Currentpress, typeidcontainer) VALUES ('A24D', 'Pensky-MARTENS');

    INSERT INTO Betinfo (Currentpress, typeidcontainer) VALUES ("A25D", "CMP");

    INSERT INTO Betinfo (Currentpress, typeidcontainer) VALUES ('A25G', 'PMC');

    INSERT INTO Betinfo (Currentpress, typeidcontainer) VALUES ('A26D', 'PMC');

    INSERT INTO Betinfo (Currentpress, typeidcontainer) VALUES ('A26G', 'PMC');

    INSERT INTO Betinfo (Currentpress, typeidcontainer) VALUES ("A32G", "V-BFC3");

    INSERT INTO Betinfo (Currentpress, typeidcontainer) VALUES ('A32D', "V-BFC2");

    CREATE TABLE 'BETODI '. "" BETMASTER ".

    (

    ACTIVATE THE "CUREPRESS" TANK (5 BYTES) NOT NULL,

    ACTIVATE THE "TYPE" VARCHAR2 (5 BYTE) NOT NULL,

    NUMBER (5.0) "LASTPCIRIM".

    )

    INSERT INTO BetMaster (Curepress, type, lastpcirim) VALUES ('A24', '45 M 8', 15);

    INSERT INTO BetMaster (Curepress, type, lastpcirim) VALUES ('A25', 42 16', 15);

    INSERT INTO BetMaster (Curepress, type, lastpcirim) VALUES ("A26", 16' 45, 15);

    INSERT INTO BetMaster (Curepress, type, lastpcirim) VALUES ("A27", '45 M 34', 16);

    INSERT INTO BetMaster (Curepress, type, lastpcirim) VALUES ('A28', '45 M 34', 16);

    INSERT INTO BetMaster (Curepress, type, lastpcirim) VALUES ('A29', '45 M 34', 16);

    INSERT INTO BetMaster (Curepress, type, lastpcirim) VALUES ('A30', '45MCH', 15);

    INSERT INTO BetMaster (Curepress, type, lastpcirim) VALUES ("A31", "45MCH", 16);

    INSERT INTO BetMaster (Curepress, type, lastpcirim) VALUES ('A32', '45MCH', 16);

    INSERT INTO BetMaster (Curepress, type, lastpcirim) VALUES ('A33', '45MCH', 16);

    INSERT INTO BetMaster (Curepress, type, lastpcirim) VALUES ("A34", "45MCH", 16);

    These two tables have left join as

    BETMASTER. CUREPRESS = substr (BETINFO. CURRENTPRESS, 1, 3)

    now I want to have the data in the two tables with fields Curepress, Lastpcirim, typeidcontainer.

    Also something like

    Make a group of typeidcontainer if this value is greater than 1 by press separated the values of semicolon (;)

    So, for example above, we should be given as

    A24 PMC 15; PENSKY-MARTENS

    A25 15 PMC

    A26 15 PMC

    A27 16 (NULL)

    A28 16 (NULL)

    A30 15 (NULL)

    A31 16 (NULL)

    A32 16 BFC2-V; V BFC3

    A33 16 (NULL)

    A34 16 (NULL)

    How could do?

    My current request is as

    Select distinct Curepress, lastpcirim, typeidcontainer

    BETMASTER STD left join INF BETINFO

    on the trim (STD. CUREPRESS) = substr (trim (INF. CURRENTPRESS), 1, 3)

    but I am unable to get the values separated by commas.

    Any help would be appreciated.

    Thank you

    Mahesh.

    Hi, Mahesh,

    If you want to only 1 row of output for each distinct combination of currentpress and lastpcirim?  This sounds like a job for GROUP BY.

    And you want the row to contain a list of all different typidcontainers-delimited?  This sounds like a job for the aggregate LISTAGG function.

    WITH joined_data AS

    (

    SELECT DISTINCT

    MST.curepress, mst.lastpcirim, inf.typeidcontainer

    OF betmaster STD

    LEFT JOIN betinfo ON TRIM (mst.curepress) inf = SUBSTR (TRIM (inf.currentpress)

    1

    3

    )

    )

    SELECT curepress, lastpcirim

    LISTAGG (typeidcontainer, ',')

    THE Group (ORDER BY typeidcontainer) AS container_list

    OF joined_data

    Curepress GROUP, lastpcirim

    ;

    Unfortunately, you can't say LISTAGG (DISTINCT ...), so you should always get the separate containers how you already are.  (Note that the subquery is just what you posted).

    Thanks for posting the CREATE TABLE and INSERT statements; It is very useful.  Don't forget to tell what version of Oracle you are using.  LISTAGG was new in Oracle 11.2.

    Why not add CHECK constraints (and perhaps triggers) to your tables, so that curepress and currentpress are not stored with the head or trailing spaces?  Then you wouldn't need to use the PAD in queries like this, and your code would be simpler and more effective.

  • help the join of two tables

    Hello

    I need your help in the script below:

    I have two tables.

    My "table1" table contains the data below:

    Code:

    Name, Value
    ------------
    12 A, 1
    12 B, 1
    12 C, 1



    Table2 contains the following data:

    Code:

    value, result
    ------------
    1.12
    1.24
    1.56
    1 423
    1.32
    1, 3




    I need to join based on a field value.

    My result is:

    Code:


    NAME, VALUE, RESULT
    -------------------------
    12 A, 1, 12
    12 B, 1: 24
    12 C, 1, 56
    12d, 1, 423
    12TH, 1, 32
    12F, 1, 3





    Based on the number of records in the second table, it must add A to Z at the end of the name field. The number of records exceeds no more than 26. How can we achieve this?


    _________________

    Thank you
    Pocard

    OK, now you give other useful information - that there always will be combinations of amounts in table2 to match values in table1. (It is difficult to help when you say the specs one both :-))

    But it is not easy, because the code should really try to consider all combinations and then 'choose the right' - it's easy for us humans, but not easy to code in the programming logic.
    I made an attempt:

    SQL> set linesize 120
    SQL> with table1 as (
      2     select 'A1' name, 123 id, 150 value from dual union all
      3     select 'A2' name, 123 id, 200 value from dual union all
      4     select 'A3' name, 123 id, 300 value from dual
      5  ), table2 as (
      6     select 123 id, 100 value from dual union all
      7     select 123 id, 100 value from dual union all
      8     select 123 id, 50  value from dual union all
      9     select 123 id, 100 value from dual union all
     10     select 123 id, 100 value from dual union all
     11     select 123 id, 100 value from dual union all
     12     select 123 id, 100 value from dual
     13  )
     14  --
     15  -- End of test data
     16  --
     17  select
     18  t1.id, t1.name, t1.value, t2.value,
     19  t1.rn, t1.minval, t1.maxval,
     20  t2.rn, t2.sumval
     21  from (
     22     select
     23     tab1.*,
     24     nvl(sum(tab1.value) over (
     25        partition by tab1.id
     26        order by tab1.rn
     27        rows between unbounded preceding and 1 preceding
     28     ),0) minval,
     29     sum(tab1.value) over (
     30        partition by tab1.id
     31        order by tab1.rn
     32        rows between unbounded preceding and current row
     33     ) maxval
     34     from (
     35        select
     36        table1.*,
     37        row_number() over (
     38           partition by table1.id
     39           order by table1.value desc
     40        ) rn
     41        from table1
     42     ) tab1
     43  ) t1
     44  join (
     45     select
     46     tab2.*,
     47     sum(tab2.value) over (
     48        partition by tab2.id
     49        order by tab2.rn
     50     ) sumval
     51     from (
     52        select
     53        table2.*,
     54        row_number() over (
     55           partition by table2.id
     56           order by table2.value desc
     57        ) rn
     58        from table2
     59     ) tab2
     60  ) t2
     61  on (t2.id = t1.id)
     62  where t2.sumval > t1.minval
     63  and t2.sumval <= t1.maxval
     64  order by
     65  t1.id,
     66  t1.rn,
     67  t2.rn
     68  ;
    
            ID NA      VALUE      VALUE         RN     MINVAL     MAXVAL         RN     SUMVAL
    ---------- -- ---------- ---------- ---------- ---------- ---------- ---------- ----------
           123 A3        300        100          1          0        300          1        100
           123 A3        300        100          1          0        300          2        200
           123 A3        300        100          1          0        300          3        300
           123 A2        200        100          2        300        500          4        400
           123 A2        200        100          2        300        500          5        500
           123 A1        150        100          3        500        650          6        600
           123 A1        150         50          3        500        650          7        650
    
    7 rows selected.
    

    It doesn't seem to work for your sample data, but it is much too simple a rule at work in general. My "rule" is simply of sorts data according to the value descending and adding up to what 'enough' of values have been added.

    Consider this example of data instead of this:

    SQL> with table1 as (
      2     select 'A1' name, 1 id, 100 value from dual union all
      3     select 'A2' name, 1 id, 200 value from dual union all
      4     select 'A3' name, 1 id, 300 value from dual union all
      5     select 'B1' name, 2 id, 100 value from dual union all
      6     select 'B2' name, 2 id, 200 value from dual
      7  ), table2 as (
      8     select 1 id, 25  value from dual union all
      9     select 1 id, 75  value from dual union all
     10     select 1 id, 50  value from dual union all
     11     select 1 id, 50  value from dual union all
     12     select 1 id, 175 value from dual union all
     13     select 1 id, 225 value from dual union all
     14     select 2 id, 25  value from dual union all
     15     select 2 id, 50  value from dual union all
     16     select 2 id, 75  value from dual union all
     17     select 2 id, 100 value from dual union all
     18     select 2 id, 50  value from dual
     19  )
     20  --
     21  -- End of test data
     22  --
     23  select
     24  t1.id, t1.name, t1.value, t2.value,
     25  t1.rn, t1.minval, t1.maxval,
     26  t2.rn, t2.sumval
     27  from (
     28     select
     29     tab1.*,
     30     nvl(sum(tab1.value) over (
     31        partition by tab1.id
     32        order by tab1.rn
     33        rows between unbounded preceding and 1 preceding
     34     ),0) minval,
     35     sum(tab1.value) over (
     36        partition by tab1.id
     37        order by tab1.rn
     38        rows between unbounded preceding and current row
     39     ) maxval
     40     from (
     41        select
     42        table1.*,
     43        row_number() over (
     44           partition by table1.id
     45           order by table1.value desc
     46        ) rn
     47        from table1
     48     ) tab1
     49  ) t1
     50  join (
     51     select
     52     tab2.*,
     53     sum(tab2.value) over (
     54        partition by tab2.id
     55        order by tab2.rn
     56     ) sumval
     57     from (
     58        select
     59        table2.*,
     60        row_number() over (
     61           partition by table2.id
     62           order by table2.value desc
     63        ) rn
     64        from table2
     65     ) tab2
     66  ) t2
     67  on (t2.id = t1.id)
     68  where t2.sumval > t1.minval
     69  and t2.sumval <= t1.maxval
     70  order by
     71  t1.id,
     72  t1.rn,
     73  t2.rn
     74  ;
    
            ID NA      VALUE      VALUE         RN     MINVAL     MAXVAL         RN     SUMVAL
    ---------- -- ---------- ---------- ---------- ---------- ---------- ---------- ----------
             1 A3        300        225          1          0        300          1        225
             1 A2        200        175          2        300        500          2        400
             1 A2        200         75          2        300        500          3        475
             1 A1        100         50          3        500        600          4        525
             1 A1        100         50          3        500        600          5        575
             1 A1        100         25          3        500        600          6        600
             2 B2        200        100          1          0        200          1        100
             2 B2        200         75          1          0        200          2        175
             2 B1        100         50          2        200        300          3        225
             2 B1        100         50          2        200        300          4        275
             2 B1        100         25          2        200        300          5        300
    
    11 rows selected.
    

    In this data set simple ranking by value won't work - it should have been A3: (225,75), A2: (175,25) and A1: (50.50).

    I can't really think of a reasonably easy way to do this in SQL only. Maybe using the clause TYPE would be possible, but not negligible. It is possible, it would be easier to solve this problem in PL/SQL in iterating through a few tables and intelligently to try different combinations, rather than creating all combinations in a huge piece of brute force SQL.

    I'm sorry, Pandeesh, but I can't think a solution easily.
    I might be able to do something, if I fiddled with the problem for a few days, but that would be beyond the scope of this forum. It would be a consultation of employment rather than a little help from the forum :-)

  • Immagerie two tables without a CARPENTER

    Hello
    I had a little problem. I want to combine the two tables. But I don't need a Carpenter, cause that would give me wrong combined values.
    I have a table working_hours which has the actual hours of work of employees. And a table times_absent that the absent employee time.
    The two tables have the date and hours actual work and absent in addition to other tings inside.
    Simple I want to combine these two tables in a large table.

    Example:
    Table working_hours:
    Name - Date - hours-...
    Mr.A - 2.5.2011 - 8-...
    Mr.B - 2.5.2011 - 6-...
    C 2.5.2011 - 7-...

    Table times_absent:
    Name - Date - day-...
    Mr.A - 3.5.2011 - 1-...
    Mr.B - 3.5.2011 - 2-...
    Mr.B - 4.5.2011 - 2-...


    New Table:
    Name - Date - Working_Hours - Absent_Days-
    Mr.A - 2.5.2011 - 8 - null - or some sort of dummy value XXX
    Mr.A - 3.5.2011 - null-- 1
    Mr.B - 2.5.2011 - 6 - null.
    Mr.B - 3.5.2011 - null - 2-
    Mr.B - 4.5.2011 - null - 2-

    and so we.

    Is there a possibility in the OWB to perform this task?

    THX

    I did not understand your answer, but the OPERATOR PUT a couple IN a GROUP. What you need to do is connect your table 1 to table 2 for INgroup2 and INgroup1 (the two tables must have the same number and type of columns and the order is also important) and set your SET UNION operator, and that's all.

  • Kindly help me with the request to find the data in two tables

    Hello Guru

    Kindly help me to recover the data from two tables-

    BASEBALL
    LEGAL_ENT_ID (PK)
    GAME_ID (FK)
    LEGAL_ENT_NM
    INACTIVE_DT
    DATE OF INS_TS
    INS_LOGIN
    DATE OF UPD_TS
    UPD_LOGIN


    FOOTBALL
    GAME_ID (PK)
    BRKR_NM,
    BRKR_ISR_ID
    BROKER_SYMBOL
    INACTIVE_DT
    BRKR_SWIFT_FLG
    BRKR_INTERNAL_FLG
    BRKR_CATEGORY
    UPD_TS
    MINORITY_FLG
    BROKER_TYP
    STATUS
    INS_TS
    INS_LOGIN
    UPD_LOGIN
    APP_USER
    ACTIVE_FLG

    and if I want fecth data from these two tables according to the following condition then it is fine with the suite of applications.

    1 select distinct values only table of BASEBALL by using the following query.

    SELECT DISTINCT B.GAME_ID as 'CLEARING GAME ID', B.BRKR_NM "NAME of THE GAME of COMPENSATION" OF BASEBALL A, FOOTBALL B WHERE A.BROKER_RELATION_CD IN ('FUTBRKR1', 'FUTBRKR2') AND A.GAME_ID = B.GAME_ID

    2 Select all the table BRKR_NM OF FOOTBALL as well by using the query - next

    SELECT GAME_ID "RUNNING GAME ID", 'NAME OF THE GAME OF EXECUTION' BRKR_NM SOCCER

    Now, my query is that--

    I want a query that gives me a combination of above mentioned queries... and if I tried to use Union or Union All, then she is not giving me the result as expected.

    I like the result to look like who has a few conditions such as -
    1 - the records in the table Football are high vs Baseball table because there is no condition to filter the records of the Football.
    2 - football is a superset of records and Baseball is a subset.
    3 - COMPENSATION NOM_JEU and RUNNING NOM_JEU may return the same values as well.

    I want the result to be in the following form-

    EXECUTION ID GAME | NAME OF THE GAME TO RUN. COMPENSATION ID GAME | DELETE THE NAME OF THE GAME.
    2123 test1 2345 test5
    2456 test10 2456 test10


    Thanks in advance. Kindly help me.

    Published by: user555994 on January 4, 2011 23:48

    In the output you want.
    All the values of baseball;
    Values of football that are matched;
    But on what condition you want to match?

  • two tables side by side...

    I am trying to create two tables and a left float and the other right (in my main content area).  Whenever I have create a second table he always jumps below the other table even if the width combined for each table is much smaller than the width of my main content.

    How this is done?

    Thank you

    Gary

    Nest them inside a table column 1 row x 2.

  • How to join two tables of different schemas of Oracle by using a subquery

    I'm trying to join two different schemas of Oracle tables using a subquery. I can extract data from each of the tables without problem. However, when I combine select statements it by using a subquery I get Oracle error *'ORA-00936: lack of expression ' *. Given that each SELECT statement runs on its own without error I don't understand what's missing. I'm trying to get the result set is matching the LINE_ID of PDTABLE_12_1 in the schema with the table PDTABLE_201 MAT_DESCRIPTION DD_12809 in the RA_12809 schema.

    The query is as follows:

    SQL = "SELECT [DD_12809]. [PDTABLE_12_1]. LINE_ID OF [DD_12809]. [PDTABLE_12_1] JOIN "_".
    + "(SELECT [RA_12809]. [PDTABLE_201]. MAT_DESCRIPTION "_".
    "FROM [RA_12809]. [PDTABLE_201]) AS FAB "_".
    + 'ON [DD_12809]. [PDTABLE_12_1]. PIPING_MATER_CLASS = FAB. PIPING_MATER_CLASS ".

    The format of the request is copied from a manual of programming SQL.

    I also tried running the query uses a right JOIN on the two tables, but got the same results. Any ideas would be useful. Thank you!

    Published by: user11338343 on October 19, 2009 06:55

    The format for the join of two tables in Oracle feels like any other database:

    SELECT a.col1, a.col2, ..., b.col1, b.col2, ...
    FROM   schema1.table1 a,
           JOIN schema2.table2 b ON a.col = b.col and ...
    WHERE  a.other_col = 'FRED'
    AND    ....;
    

    Do not place bracketed identifiers in Oracle. The account that connects to the database must have select privileges on the two tables.

  • How to make an update of a view online two tables...

    When the unique constraint of the second table includes three columns?

    I have two tables A and B and I want to update a table column, one using an update of a view online two tables.

    Table A:
    col1 primary key
    col2

    Table B:
    col1 u1
    col2 u2
    COL3 u3
    COL4
    col5

    Table col1 primary key, table B has a unique constraint on col1, col2 and col3.

    Tables A and B are joined in this way:
    select  A.col1, A.col2 as KEY_OLD, B.col5 as KEY_NEW
    from    A, B
    where (B.col1 = 'literal_1') and (B.col2 = 'literal_2') and (A.col1 = B.col3) and (A.col2 = B.col4)
    And now, I want to update this view and set KEY_OLD = KEY_NEW.

    Because of the first three conditions in the where clause for each entry in the table A there is just a matching entry in the table B.
    So the table should be preserved in the join key.

    But during the update
    update (select  A.col1, A.col2 as KEY_OLD, B.col5 as KEY_NEW
                from    A, B
                where (B.col1 = 'literal_1') and (B.col2 = 'literal_2') and (A.col1 = B.col3) and (A.col2 = B.col4)
               )
    set     KEY_OLD = KEY_NEW;
    I get an error ORA-01779.

    I did the updates on inline views this way several times in recent weeks and it work very well.
    But so far the unique constraint on the table B was just a column ;-)

    So what I need is to make it work with the unique constraint on the application of the three-column table B.

    Thank you very much in advance for any help.

    Hartmut cordially

    Preserved key criteria must be met by the join columns, the optimizer does not agree (in fact I never tried in 11g) just a combination of columns, literals and join.

    The alternatives you have are subqueries online (which as you point out can do rather worse), the command MERGE or indicator BYPASS_UJVC semi undocumented.

Maybe you are looking for