How to link two tables with a part of a cell value

I have 1 column, which contains info like this "1 to 4 numbers - two words" in tableA

for example

985 - train series

14 baby Doll

874 piano keyboard

6 - DVD player

etc.

In table B I have columns with the numbers of toys 1 and 2 which has the price.

I want to write a query that gives me the number, name and price.

But I don't know how to link part of the value in a cell with another table.

I know that the database is not normalized, but I did not design and I have no permission to change.

Kind regards

What have you tried?

Please read: Re: 2. How can I ask a question on the forums?

Sounds to me like you just want to join the tables on a partial string, so to make you just extract the numbers from the table A Column1.

for example

TO_NUMBER (substr (A.col1, 1, instr(' ')-1))

Tags: Database

Similar Questions

  • How to link two tables with form

    Hello

    Here's what I want to do

    I have a table-> Student (rollno, name)

    I also have these two tables (rollno, marks) Math Physics (rollno, marks)

    now, I want to have a form in my page (in which I can navigate school records) and two tables in the adf (Math, physical). When selecting a certain record of the form, I want to see data associated with these two tables.

    I try to make the link display but works for me...

    Please help me on this.

    -Usman

    -Open the module of the application

    -Go to the model data tab

    -You will see all the your available on the left and your already added to the AM to the right

    -For the your who are 'master' for others your (in your case, student VO's master VO of Math and physics VO), you will see a (+) monkey behind it

    -Expand this node and you will see the math and physics your.

    -Math VO on the left and the VO student on the right then click on the button (>) to shuttle Math VO VO of the student child and give it a name

    -Repeat step for physics VO

    After completing the above steps and save, go back to your jsf (or jspx or...) and in the data tab control you will see this student VO is now two children, Math and physics. Use WHAT YOUR theses to create your tables for details.

    Kind regards.

  • How to create a table with a column that is the value in another table?

    Hi all,

    It's my first post n I changed my ODI of DATASTAGE platform. Help me friends n I know basic steps in 11 ODI version which I was training in my company. I hope to have your support and can do everything an action ODI related documents.

    My question is...

    Table T1 > > > > > > > > > >

    service id / / / attr.name / / / attr.value

    S1 / / / product_code / / / P1

    S1 / / / provider / / / pro1

    S2 / / / product_code / / / P2

    S3 / / / provider / / / pro3

    Table T2 > > > > > > > > > > > > > > >

    ID / / / product_code / / / provider

    S1 / / / p1 / / / pro1

    S2 / / / p2 / / / nullvalue

    S3 / / / nullvalue / / / pro3


    I have a table T1 since I should show the table T2 is released. Can we say everything on how to write a logic and steps to follow.

    Thanks in advance.

    Published by: 854662 on April 26, 2011 01:59

    Hello

    U go.

    1 the interface:

    "Put a filter in your 1 on attr.name = array ' PRODUCT_CODE.

    In the map target TABLE2
    SERVICE_ID = TABLE1. SERVICE_ID
    PRODUCT_CODE = TABLE1. ATTR_VALUE

    Use SQL IKM append control

    Interface 2:

    "Put a filter in your 1 on attr.name = array ' PROVIDER '.

    In the map target TABLE2
    SERVICE_ID = TABLE1. SERVICE_ID
    PROVIDER = TABLE1. ATTR_VALUE

    Do SERVICE_ID as KEY (when you click the column target in properties, you can see KEY under properties of the target column) and use the incremental update of the IKM Oracle.

    PS: I assume that Oracle as the source and target.

    And you can refer to the documentation,

    https://Apex.Oracle.com/pls/Apex/f?p=44785:24:4413167952886630:no:24:P24_CONTENT_ID, P24_PREV_PAGE:5185, 29

    http://odiexperts.com/

    And of course this OTN.

    Thank you
    Guru

  • How to match columns from two tables with

    Hello:
    I have two tables as below:

    Table1::(Base Table)
    Country | Prefix | Prefix_Length
    Travel | 001 | 3
    CountryB. 0012 | 4
    PaysC | 00443 | 5
    CountryD | 0091 | 4

    :(Detail Table) table2
    The population | Area | Prefix
    500 | AreaA | 0015921
    1000 | AreaB | 00122
    400. AreaC. 00443743
    300. ALIS | 0091333
    100. AreaA | 001

    I need to match these two tables with prefix columns (whose length is not fixed in the two tables: but it starts with 00 in the two tables). Two different countries the prefix may be similar up to a certain length. Thus, Prefix_Length can be used to determine (exactly) how much time should be taken in the search of Table2.

    Output:
    Country | Prefix | Area | Population
    Travel | 001 | AreaA | 600
    CountryB. 0012 | AreaB | 1000
    PaysC | 00443 | AreaC. 400
    CountryD | 0091 | ALIS | 300

    Please help me with your valuable comments.

    -Tender

    Try this

    with base_table as (
                        select 'CountryA' country,'001' prefix,3 prefix_length from dual union all
                        select 'CountryB','0012',4 from dual union all
                        select 'CountryC','00443',5 from dual union all
                        select 'CountryD','0091',4 from dual
                       ),
       detail_table as (
                        select 10 no_of_call,'0015921' prefix from dual union all
                        select 3,'00122' from dual union all
                        select 50,'00443743' from dual union all
                      select 50,'00443643' from dual union all
                        select 300,'0091333' from dual union all
                        select 60,'001' from dual
                       ) 
    
    SELECT  country,
            prefix,sum(no_of_call)
       FROM (
             select  country,
            b.prefix,no_of_call,
            decode(no_of_call,lead(no_of_call,1,0) over(partition by no_of_call order by b.prefix,no_of_call),'y','n') y_or_no
      from  base_table b,
            detail_table d
      where b.prefix = substr(d.prefix,1,prefix_length))
      where y_or_no !='y'
      group by  country,
            prefix
      order by country,
            prefix;
    

    Published by: Vi on 20 February 2012 01:07

  • How to create a table with two unique columns

    How to create a table with two unique columns. I use the following syntax below and I get the error message such unique or primary key already exists.

    create the table COPQ_WORKCELL_GOAL
    (
    Type_id varchar2 (4) NOT NULL UNIQUE,
    Tyle_Location varchar2 (30) NOT NULL UNIQUE,
    Type_Description varchar2 (20).
    KEY elementary SCHOOL (Type_id)
    );

    Use 1 or the other column type_id;

    create table COPQ_WORKCELL_GOAL
    (
      Type_id varchar2(4),
      Tyle_Location varchar2(30) NOT NULL UNIQUE,
      Type_Description varchar2(20),
      PRIMARY KEY (Type_id)
    );
    
    Table created
    drop table COPQ_WORKCELL_GOAL;
    
    Table dropped
    create table COPQ_WORKCELL_GOAL
    (
      Type_id varchar2(4) primary key,
      Tyle_Location varchar2(30) NOT NULL UNIQUE,
      Type_Description varchar2(20)
    );
    
    Table created
    
  • by comparing the two tables with

    With the help of 10 gr 2

    Assuming that we have two tables with the following structure:
    create table1 (integer id, amount1 number, status varchar2 (200));
    create table2 (integer id, number, status varchar2 amount2 (200));

    Table1 contains a single line:
    ID = 4711, amount1 = 3, status = "not ok".

    Table2 contains one or more lines with table2.id = table1.my_field referenced:
    ID = 4711, amount2 = 2, status = "not ok".
    ID = 4711, amount2 = 2, status = "not ok".
    ID = 4711, amount2 = 1, status = "not ok".
    ID = 4711, amount2 = 4, status = "not ok".

    The amount1 in Table1 is a cumulative sum of Table2 lines what status should be set to "ok". Table1.my_field is particularly well indexed.

    How to make all the lines (for example via the rowid) from Table2 that sum on amount2 is the amount1 in the line after line in Table1 (for switching their table2.status to 'ok')?
    I hope my question is clear enough...

    Try this

     SQL> select * from table2;
    
            ID    AMOUNT2 STATUS
    ---------- ---------- ------
          4711          2 Ok
          4711          2 not ok
          4711          1 Ok
          4711          4 not ok
    
    SQL> roll
    Rollback complete.
    SQL> select * from table1;
    
            ID    AMOUNT1 STATUS
    ---------- ---------- ------
          4711          3 not ok
    
    SQL> select * from table2;
    
            ID    AMOUNT2 STATUS
    ---------- ---------- ------
          4711          2 not ok
          4711          2 not ok
          4711          1 not ok
          4711          4 not ok
    
    SQL>
    SQL>
    SQL> update
      2     table2 a
      3  set
      4     a.status = 'Ok'
      5  where
      6     rowid in
      7       (select t2.rowid
      8       from
      9             (select
     10                     table2.*,
     11                     sum(amount2) over (partition by id order by rn) rn_total
     12             from
     13                     (select table2.*, row_number() over (partition by id order by amount2) rn from  table2 ) table2)  t2,
     14             table1
     15        where
     16             table1.id = t2.id and
     17             t2.rn_total <= table1.amount1)
     18  /
    
    2 rows updated.
    
    SQL> select * from table2;
    
            ID    AMOUNT2 STATUS
    ---------- ---------- ------
          4711          2 Ok
          4711          2 not ok
          4711          1 Ok
          4711          4 not ok
    
    SQL>
    
  • 5.6.1 pages: How to create a table with more than 999 lines?

    5.6.1 pages: How to create a table with more than 999 lines?

    The table on Pages v5.6.1 line selector is limited 3-digit, as it is in Pages ' 09 v4.3. Either use LibreOffice Writer, who does not have any constraint line on processing tables 3-digit, or any application spreadsheet for top 3-digit row needs.

  • How to bridge two computers with their own operating system, Server1 to Server2 in the same room.

    Original title: bridge two segents HOW?

    Seem like MS does not explain how to fill two computers with their own operating system-> beautiful graphics and he said it's possible-> we know how to add segments to the bridge after its creation?  Server1 to Server2 in the same room.

    This issue is beyond the scope of this site and must be placed on Technet or MSDN

    http://social.msdn.Microsoft.com/forums/en-us/home

  • can anyone tell how to compare two documents with two controlled with the same mouse pointers

    can anyone tell how to compare two documents with two controlled with the same mouse pointers?

    Windows and OS X can only display a mouse pointer - it is created by the operating system, not the application.

  • to link two tables in ap

    Hello
    could someone pls guide me to link ap_invoices_all table with gl_code_combinations
    thanking in advance

    Published by: makdutakdu on October 14, 2010 12:15

    Hello.

    Column-> column GL_CODE_COMBINATIONS CODE_COMBINATION_ID ACCTS_PAY_CODE_COMBINATION_ID of AP_INVOICES_ALL

    I hope this helps.

    Octavio

  • How to link 2 tables?

    I just started to Jdeveloper (I use drag and drop beginner style) and I have a question:

    I want 2 tables on the same page (using the default tables Department and employers).
    When I select a line in the department table, I want the employer table to show me the employers in that Department.

    Very simple problem, I tried to use associations and links so far, but I probably messed up or missed something.
    If someone could teach me step by step or me a link to a tutorial would be great.

    I used the form (with navigation) - table method and works (without any association or display links or whatever it is) as shown in the tutorial. But I want 2 tables and I can't understand it.

    I'm having a bad time fidning resources for learning it, in my opinion, he has a lot of steep learning and not enough learning resources (no video tutorials?: ().)

    Thank you!

    The form of navigation for sample table requires a connection between the master and detail too. You may not have noticed, but it's there.

    I never tried it myself, but it should be possible to do so. When you create the data model master detail relationship departments and employees his game in upwards automatically. If you open the module of the application data model, you should see a departments view with a view of the employees below.

    Now you design a page and drag the view of ministries since the data control on the page, and drop as table do the unique selection of the table. Now, select the view of departments in the data control, open the node and seek the views of employees inside. It is the part of retail. Drag the view of the employees on the page and drop it in the table. Make the selection single table or multi.

    Now, you must implement a partial trigger between the two tables. Open the properties of the employees table and find the partial trigger property. Select the small arrow to the right and select Edit. In the dialog box, you find the departments table, and select. Close the dialog box.

    You can now launch the application. I'm not sure that the partial trigger is sufficient to get the array of updated detail. You will need to implement a selection listener in a bean for the main table and update the details from there.

    Timo

  • How to attach two photos with window live photoshop

    How to join two or more pictures with window live photoshop... Please tell me...

    Hi puneetdeol,

    Thanks for posting your question in the Microsoft answers Forum. For any questions about Windows Live Photo Gallery, please visit the following link:

    http://windowslivehelp.com/forums.aspx?ForumID=cafb0556-8959-49b9-AFEB-635314aa02f3

  • How to join two tables if you transpose the rows, columns and rows in one of the table

    Hi guys,.

    can someone help me please in the write request

    I have two tables

    Agents and Agent phones but in the agent phones table for the id of an agent it displays 4 rows because one of the column there types of different phones (office, mobile, home, fax)

    So instead of display 4 rows, I used max(case...) to convert rows to columns

    now how to reach it with another table

    Requirement:

    Database: 11.2.0.2.0

    create the table AGENT_PHONE

    (

    agent_id NUMBER (20) not null,

    agent_type_code VARCHAR2 (10) not null,

    agent_type_prefix VARCHAR2 (10) not null,

    Phone_Number VARCHAR2 (16) not null,

    phone_type_code VARCHAR2 (10) not null

    )

    CREATE TABLEAGENTS

    (

    agent_id NUMBER (20) not null,

    agent_type_code VARCHAR2 (10) not null,

    agent_type_prefix VARCHAR2 (10) not null,

    NAME VARCHAR2 (40) NOT NULL

    )

    INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)

    VALUES (29709, ARE ', 'OFFICE', '4805551436', 'CELL');

    INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)

    VALUES (29709, ARE ', 'OFFICE', '1111111111', 'PHONE');

    INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)

    VALUES (29709, ARE ', 'OFFICE', '2223334444',' OFF');

    INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)

    VALUES (29709, ARE ', 'OFFICE', '5556667788', 'FAX');

    INSERT INTO VALUES AGENTS

    (29709, ARE ', 'OFFICE', 'FLY');

    INSERT INTO VALUES AGENTS

    (1234, ARE ', 'OFFICE', 'MIKE');

    SELECT * FROM AGENT_PHONES

    AGENT_IDAGENT_TYPE_CODEAGENT_TYPE_PREFIXPHONE_NUMBERPHONE_TYPE_CODE

    ---------------------------------------------------------------------------------------------

    29709REOFFICE4805551436CELL
    29709REOFFICE1111111111PHONE
    29709REOFFICE2223334444OFF
    29709REOFFICE5556667788

    FAX

    SELECT * AGENTS

    AGENT_IDAGENT_TYPE_CODEAGENT_TYPE_PREFIX

    NAME

    29709REOFFICEROB
    1234REOFFICE

    MIKE

    This is so the data we have in both table

    Now, I transposed rows to columns in the table of agent phones so I used the following query

    SELECT AP. AGENT_ID,. AGENT_TYPE_CODE,. AGENT_TYPE_PREFIX.

    MAX (CASE WHEN AP. PHONE_TYPE_CODE = 'CELL' THEN AP. PHONE_NUMBER END) AS CELL.

    MAX (CASE WHEN AP. PHONE_TYPE_CODE = 'OFF' THEN AP PHONE_NUMBER END) AS TURNED OFF.

    MAX (CASE WHEN AP. PHONE_TYPE_CODE = 'FAX' THEN AP. PHONE_NUMBER END) LIKE FAX,.

    MAX (CASE WHEN PHONE_TYPE_CODE = 'PHONE'. THEN AP PHONE_NUMBER END) AS PHONE

    AGENT_PHONE AP

    WHERE AP. AGENT_ID = 29709

    GROUP OF AP. AGENT_ID, AP. AGENT_TYPE_CODE, AP. AGENT_TYPE_PREFIX.

    AGENT_IDAGENT_TYPE_CODEAGENT_TYPE_PREFIXCELLOFFFAXPHONE
    129709REOFFICE4805551436222333444455566677881111111111

    My question is how this to join the agents table so that my output should be like this...

    I want to display all the results in the table of the Agent, even if they are not in the table of agent phones. As you can see there are other agent id 1234 is also populated

    AGENT_IDAGENT_TYPE_CODEAGENT_TYPE_PREFIXNAMEAGENT_IDAGENT_TYPE_CODEAGENT_TYPE_PREFIXCELLPHONEOFFFAX

    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    29709REOFFICEROB29709REOFFICE4805551436111111111122233344445556667788
    1234REOFFICEMIKE

    Currently, I run this query and I get the output as below

    SELECT *.

    AGENTS HAS

    LEFT OUTER JOIN AGENT_PHONE AP

    ON A.AGENT_ID = AP. AGENT_ID

    AND A.AGENT_TYPE_CODE = AGENT_TYPE_CODE.

    AND A.AGENT_TYPE_PREFIX = AGENT_TYPE_PREFIX.

    AGENT_IDAGENT_TYPE_CODEAGENT_TYPE_PREFIXNAMEAGENT_IDAGENT_TYPE_CODEAGENT_TYPE_PREFIXPHONE_NUMBERPHONE_TYPE_CODE
    129709REOFFICEROB29709REOFFICE4805551436CELL
    229709REOFFICEROB29709REOFFICE1111111111PHONE
    329709REOFFICEROB29709REOFFICE2223334444OFF
    429709REOFFICEROB29709REOFFICE5556667788FAX
    51234REOFFICEMIKE

    I want id 29709 agent in a line with 1234 agent also id to display

    You can rotate your phone number of agent in columns

    Select *.

    of AGENT_PHONE

    pivot)

    min (PHONE_NUMBER)

    for PHONE_TYPE_CODE in ('CELL' as a 'CELL', 'PHONE' like 'PHONE', 'OFF' in the 'OFF', 'FAX' as 'FAX')

    )

    AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX CELL PHONE OFF FAX
    29709 RE OFFICE 4805551436 1111111111 2223334444 5556667788

    Then you can join to view inline or CTE

    with AGENT_PHONE_PIVOT like)

    Select *.

    of AGENT_PHONE

    pivot)

    min (PHONE_NUMBER)

    for PHONE_TYPE_CODE in ('CELL' as a 'CELL', 'PHONE' like 'PHONE', 'OFF' in the 'OFF', 'FAX' as 'FAX')

    )

    )

    SELECT *.

    AGENTS HAS

    LEFT OUTER JOIN AGENT_PHONE_PIVOT AP

    ON A.AGENT_ID = AP. AGENT_ID

    AND A.AGENT_TYPE_CODE = AGENT_TYPE_CODE.

    AND A.AGENT_TYPE_PREFIX = AGENT_TYPE_PREFIX.

    AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX NAME AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX CELL PHONE OFF FAX
    29709 RE OFFICE ROB 29709 RE OFFICE 4805551436 1111111111 2223334444 5556667788
    1234 RE OFFICE MIKE - - - - - - -

    Is that what you're looking for?

  • How to create a table with these dimensions?

    Still new in Indesign, but I need to create a table like the one below.

    Screen Shot 2015-03-10 at 2.31.25 AM.png


    Select the text tool, I created a block of text and then insert a table. However, I'm lost as to how to change the top line for the length of the two columns from the bottom.
    I looked at the options of panel paintings, but it only allows me to change the number of lines and columns.

    All advice is appreciated. Thank you.

    You must create a table with two rows and two columns.

    To select the first line and click "merge cells".

  • Insert two tables with a single query (same ID)

    Hello

    I want to insert two tables at the same time (with a single request) provided that both records get inserted with the same identifier. How can I do this?
    Table Movies
    id 
    name
    
    Table Category
    movie_id
    cat_type
    (a) insert in the first table, retrieve the id (can be using
    my_sequence.currval
    and then insert into another table.

    question: He brings three queries to the Database, I also suspect that when several people trying to insert there is a problem, I could be wrong.

    I have no other idea.

    Greatly appreciated!

    think you need to do as an anonymous pl/sql block.

    Dim cn As New OracleConnection("DataSource = xx'; user id = xx; password = xx;")
    
    Try
     'build the anonymous pl/sql
     Dim sb as New System.Text.StringBuilder
     sb.Append("declare")
     sb.Append(" l_N number;")
     sb.Append("begin")
     sb.Append("insert into movies (id,name) values (my_sequence.nextval, 'film1') returning id  into l_N;")
     sb.Append( "insert into category values (l_N, 'Category type');")
     sb.Append(" END;")
    
     'create commd object
    
     Dim cmd as New OracleCommand(sb.ToString,cn)
     cmd.Connection.Open()
     cmd.ExecuteNonQuerry()
     cmd.Connection.Close()
     cmd.dispose()
     Catch ex as Exception
    
      blah blah blah
    
    End try
    
      
    

    Published by: pollywog on May 28, 2010 10:48

    Published by: pollywog on May 28, 2010 10:49

Maybe you are looking for