extraction of unique records of registration of two different tables

Hello

In the following two tables different www.testing.com code exists in both tables. I want to compare two different columns from two different tables for unique records.
SQL> select unique(videoLinks) from saVideos where sa_id=21;

VIDEOLINKS
-----------------------------------------------------------------------
www.testing.com

SQL> ed
Wrote file afiedt.buf

  1* select unique(picLinks) from saImages where sa_id=21
SQL> /

PICLINKS
-----------------------------------------------------------------------
test
test14
www.hello.com
www.testing.com
Thank you and best regards

Try
Select unique (videoLinks) in the saVideos where sa_id = 21
Union
Select unique (picLinks) in the saImages where sa_id = 21

Tags: Database

Similar Questions

  • Insertion of records in two different tables at the same time?

    Hello everyone, I have question about inserting records in two different tables at the same time, I'm looking for is by the way a unique id, which is created in the first statement insert to the second insert statement. Example of this problem:

    < cfquery name = "addRecords1" datasource = 'test' >

    Insert Into Table1 (name, Date, age)

    Values (< cfqueryparam cfsqltype = "cf_sql_char" value = "#arguments.) "Name # ' >.

    < cfqueryparam cfsqltype = 'cf_sql_date' value = '#arguments. "Date # ' >.

    < cfqueryparam cfsqltype = "cf_sql_int" value = "#arguments. Age #"(>); "

    Select SCOPE_IDENTITY() as RecID;

    < / cfquery >

    < cfquery name = "addRecords2" datasource = 'test' >

    Insert into Table2(Company,City,Date,ID)

    Values (< cfqueryparam cfsqltype = "cf_sql_char" value = "#arguments.Company #" >,)

    < cfqueryparam cfsqltype = "cf_sql_char" value = "" #City # ">,"

    < cfqueryparam cfsqltype = 'cf_sql_date' value = "" #Date # ">,"

    ( < cfqueryparam cfsqltype = "cf_sql_int" value = "How to pass RecID to insert in this table?" >).

    < / cfquery >

    In this example, I'm inserting records in table 1 and creation of IDENTITY SCOPE as RecId. I would like to pass this id and insert it in my table 2. This Id, I'll use in my second table as an identifier. If anyone knows anything about this please let me know. Thank you.

    );
    

    QueryName - DOT - ColumnName, so it should be:

    );
    

    HTH,

    ^_^

  • Problem using Extract IMAQ. Don't not out two different images

    Hi, I am using the multiple functions of extract IMAQ for some parts of the image of the webcam, then using color extracted from function to get values of RGB. The problem is that two functions extract IMAQ give the same image on its out port. The extract of diagram of block and VI are attached below. Also, please let me know if there is a better way to do this. I need to expand this later to extract parts of the image instead of two different about 40 - 50 RGB values below.

    It's happened because IMAQ Images transferred by references. You must provide images of different destination for each extraction:

    Andrey.

  • How to get into two different tables in two columns of a listbox of multi column

    Hi all

    I have two different tables of the values assume that table 1A (1,2,3,4,5) and another table B (3,4,5,6,7). I want to write these tables in a multicolumn listbox such as 1st column would be A array and 2nd column table B.

    Thnx in advance

    Saki,

    I hope this helps to further

  • Process in two different tables in one page

    Hi all

    I have A form with a submit button, when I click on the button I want to send the data from two different tables. For example:

    REQ_ID: 221

    BOX_NUMBER: 2

    NOM_ELEMENT: APPLE

    COUNTRY_ORIGIN: USA

    I want to send all the information in table 1 and only REQ_ID and BOX_NUMBER in table 2.

    I tried to create processes two different which are:

    1. the usual process line DML for table 1 and;

    2. simple query 'Insert' SQL for table 2

    It seems fine, until I realized that when the user tries to update the BOX_NUMBER to 10 for example, only 1 table is updated and table 2 creates an another duplicate data instead of updating the old one! This also applies to my button Delete,.

    any idea to fix this problem?

    Thank you very much

    Vika

    Reread what you wrote and you would realize why 2nd table only "new lines".

    2. simple query "Insert into ' SQL for table 2

    If you need to UPDATE the table, then you must write a simple UPDATE statement.

    If you want to REMOVE from the table, then you must write a simple DELETE statement.

    I call this "DML DIY" - do it yourself DML

    (personally, I'd probably use MERGE for INSERT and UPDATE)

    MK

  • Select Max (Date) in two different tables...

    Dear all,

    I need the date of last update of two different tables, I mean max (date). We will update one table at a time. Updated once I need to take the last update.

    It can be either in table A table B.

    for example.

    Table A

    Date of the ID

    100 16/05/2014

    101 20/05/2014

    102, 22/05/2014

    Table B

    Date of the ID

    100 04/06/2014

    101, 26/05/2014

    102 21/05/2014

    I need the date of table B (101 26/05/2014) last updated date...

    Hello

    Another way, using much more GRAND:

    SELECT LARGER (max1, max2) x

    FROM (SELECT MAX (mydate) max1

    OF mytable_a

    )

    (SELECT MAX (myotherdate) max2

    OF mytable_b

    )

    ;

    Best regards

    Bruno Vroman.

  • To find common data in 2 columns from two different tables.

    Hello

    Could someone help me with a querry to discover common data of 2 columns from two different tables?

    Thank you
    Rajesh

    Try as below.

    select col1 ,col2 from tab1
    intersect
    select col1 ,col2 from tab2;
    
  • Possibility to delete records in two different table in the same DB

    Regarding the title of the Message, if it is possible, please show me the SQL (using MS SQL 2000) command to perform this operation. Thank you very much.

    clixmax wrote:
    > Regarding the title of the Message, if it is possible, please show me the SQL code
    > command (using MS SQL 2000) to perform this operation. Thank you very much.

    SET NOCOUNT ON

    REMOVE tableOne
    WHERE someCondition = #form.someCondition #.

    REMOVE tableTwo
    WHERE someCondition = #form.someCondition #.

    SET NOCOUNT OFF

  • How can I select the first date (at least) and the corresponding date of two different tables source?

    I have 2 tables, INVOICE and INVOICE_REFNUM similar to below. I'm writing a query that withdrawing the first date (less) for a single record remaining the two tables. Each table records the receipt of invoices, but according to the source of the received invoice some may reside in INVOICE_REFNUM and others the INVOICE table. I also use DECODE on the topic of INVOICE_SOURCE, when the date less is taken from the INVOICE table that contains that field, so if the date is in the field INVOICE_REFNUM DECODE is not necessary. Example:

    INVOICE (table)

    INVOICE_GID INVOICE_SOURCE INSERT_DATE

    ABC. AVRT123 I HAVE 11/03/2012-15:49:32

    ABC. CNWY234 G 12/03/2012 14:07:30

    ABC. UPGF678 M 15/03/2012 20:21:54

    INVOICE_REFNUM (table)

    INVOICE_GID INVOICE_REFNUM_QUAL INVOICE_REFNUM_VALUE INSERT_DATE

    ABC. AVRT123 SOURCE ACS 11/03/2012 14:49:32

    ABC. CNWY234 SOURCE CSA 12/03/2012 13:07:30

    ABC. UPGF678 SOURCE ACS 15/03/2012 21:21:54

    My decode statement is: DECODE ("INVOICE_SOURCE, 'I', 'IDE', 'G', ' Auto-Pay", ', 'Manual')

    If I were to write a query on these two tables, the output will resemble the following:

    INVOICE_GID INVOICE_SOURCE INSERT_DATE

    ABC. AVRT123 ACS 11/03/2012 14:49:32

    ABC. CNWY234 ACS 12/03/2012 13:07:30

    ABC. UPGF678 Manual 15/03/2012 20:21:54

    I worked on it for 2 days, and I was able to pull a date by using the following SQL code, but cannot determine how to extract the corresponding source:

    SELECT THE LEAST (GLOGOWNER. INVOICE_REFNUM. INSERT_DATE, GLOGOWNER. THE INVOICE. INSERT_DATE) AS 'DATE OF THE INVOICE.

    GLOGOWNER. THE INVOICE. INVOICE_GID,

    DECODE (GLOGOWNER. THE INVOICE. INVOICE_SOURCE, 'I', 'IDE', 'G', 'Auto-Pay', ', 'Manual').

    GLOGOWNER. INVOICE_REFNUM. INVOICE_REFNUM_VALUE

    OF GLOGOWNER. INVOICE

    LEFT JOIN GLOGOWNER. INVOICE_REFNUM

    ON GLOGOWNER. THE INVOICE. INVOICE_GID = GLOGOWNER. INVOICE_REFNUM. INVOICE_GID

    WHERE GLOGOWNER. INVOICE_REFNUM. INVOICE_REFNUM_VALUE = "ACS."

    AND GLOGOWNER. INVOICE_REFNUM. INVOICE_REFNUM_QUAL_GID = 'SOURCE '.

    AND GLOGOWNER. THE INVOICE. INVOICE_TYPE = 'I '.

    ORDER OF GLOGOWNER. THE INVOICE. INVOICE_GID

    Any help is greatly appreciated!

    Best regards

    -Adam

    Hello

    Is that what you want?

    SELECT i.invoice_gid

    CASE

    WHEN ir.insert_date<= i.insert_date ="" then ="">

    WHEN i.invoice_souce = 'I' and THEN 'EDI '.

    WHEN i.invoice_souce = 'G' THEN 'debit '.

    WHEN i.invoice_souce = am' THEN 'manual '.

    END AS invoice_source

    , The LEAST (i.insert_date, ir.insert_date) AS insert_date

    I have the Bill OF

    JOIN invoice_refnum ON i.invoice_gid = ir.invoice_gid ir

    WHERE ir.invoice_refnum_value = 'ACS '.

    AND ir.invoice_refnum_qual_gid = 'SOURCE '.

    AND i.invoice_type = 'I '.

    ORDER BY i.invoice_gid

    ;

    There is no reason to do an outer join if you only want the lines with specific values anyway.

    What happens if the 2 tables have exactly the same invoice_date?  The query above takes the invoice_source of invoice_refnum in this case, but that can easily be changed.

    Or the other of the insert_dates can be NULL?

    I hope that answers your question.

    Otherwise, thank you post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also after the results you want from these data (otherwise what you have already posted).

    Explain, using specific examples, how you get these results from these data.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002#9362002

  • I want to loop through the data from two different tables using for loop where the query should be replaced at runtime, please help me

    I have the data into two table with the structure of similar column, I want to loop through the data in these two tables

    based on some condition and runtime that I want to put the query in loop for example, the example is given, please help me

    create table ab (a number, b varchar2 (20));

    Insert into ab

    Select rownum, rownum. "" sample "

    of the double

    connect by level < = 10

    create table bc (a number, b varchar2 (20));

    Insert into BC.

    Select rownum + 1, rownum + 1 | "" sample "

    of the double

    connect by level < = 10

    declare

    l_statement varchar2 (2000);

    Boolean bool;

    Start

    bool: = true;

    If it is true, then

    l_statement: =' select * ab ';

    on the other

    l_statement: =' select * from bc';

    end if

    I'm in execute immediate l_statement - something like that, but I don't know

    loop

    dbms_output.put_line (i.a);

    end loop;

    end;

    Something like that, but this isn't a peace of the code work.

    Try this and adapt according to your needs:

    declare

    l_statement varchar2 (2000);

    c SYS_REFCURSOR;

    l_a number;

    l_b varchar2 (20);

    Boolean bool;

    Start

    bool: = true;

    If it is true, then

    l_statement: = "select a, b, AB;

    on the other

    l_statement: = "select a, b from bc;

    end if;

    --

    Open c for l_statement;

    --

    loop

    extract the c in l_a, l_b;

    When the output c % notfound;

    dbms_output.put_line (l_a |') -' || l_b);

    end loop;

    close c;

    end;

    /

  • Generate the command Id and insert data into two different tables: oracle apex 5.0

    I have three tables. name of the tables: PRODUCT, ORDER_HEADER, ORDER_DETAIL. I took REPORT inter ASSETS in which the VALUES from TABLE product. I need to use the trigger here, there is a TEXT ARTICLE called ORDER ID: it will generate through trigger. so whenever new order placed order id must be unique. There is a button when this button is clicked, the VALUES of REPORT must be inserted in to ORDER_HEADER , ORDER_DETAIL (in fact, I am in confusion is it even possible).

    I tried to create the trigger: not work if


    CREATE OR REPLACE TRIGGER "EMP_TRG1".

    Before Insert on order_header

    for each line

    Start

    If: new. Order_ID is null

    then

    Select lpad (demo_seq.nextval, 8, '0'): new. Order_ID order_header;

    end if;

    end;

    SQL:

    Select

    apex_item. Text(1,p.PRODUCT_ID) PID.

    PN.product_name,

    apex_item. Text(2,p.PRODUCT_QTY) qt.

    apex_item. Text(3,p.unit_price) upward,

    apex_item. Text(4,p.TOTAL_AMOUNT) am

    OMS_SHIP_CART_DETAIL p, pn OMS_PRODUCT

    where p.product_id = pn.product_id

    DA:

    var arr_f01 = [];

    var arr_f02 = [];

    var arr_f03 = [];

    var arr_f04 = [];

    var arr_f05 = [];

    product_id var;

    unit_price var;

    Var Qty;

    var total_1;

    () $("input[name='f01']").each

    function() {}

    product_id = $(this).closest('tr') .children ('td [headers = 'PID']') .text ();

    unit_price = $(this).closest('tr') .children ('td [headers = "Uprice"]') .text ();

    Qty = $(this).closest('tr') .children ('td [headers = "Qty"]') .text ();

    total_1 = $(this). Closest ('tr'). Children ('td [headers = "total"]'). Text();

    arr_f01.push ($(this).) Val());

    arr_f02.push (product_id);

    arr_f03.push (total_1);

    arr_f04.push (unit_price);

    arr_f05.push (Qty);

    }  );

    (apex). Server.Process

    "Insert a command."

    , {f01: arr_f01, f02: arr_f02, f03: arr_f03, f04: arr_f04, f05: arr_f05}

    }

    , {dataType: "text", success: function (pData) {alert ('added product') ;}}

    );

    Ajax callback:

    declare

    l_count number;

    Start

    -insert into OMS_ORDER_HEADER (USER_ID, TOTAL_AMOUNT, batch, ORDER_DATE) values(:P1_USER_ID,:P42_TOTAL,'PENDING',SYSDATE);

    I'm looping 1.apex_application.g_f01.count

    insert into OMS_ORDER_DETAIL (PRODUCT_ID, UNIT_QTY, UNIT_PRICE, TOTAL_AMOUNT)

    values (APEX_APPLICATION. G_F01 (i), APEX_APPLICATION. G_F03 (i), APEX_APPLICATION. G_F04 (i), APEX_APPLICATION. G_F05 (i));

    commit;

    end loop;

    end;

    Hi Dominique,.

    I create a process page away present in your application

    declare
      l_order_id varchar2(8);
    begin
      insert into order_header(ORDER_ID
                            , STATUS
                            , ORDER_DATE)
                      values(lpad(demo_seq.nextval,8,'0')
                            , 'Pending'
                            , sysdate)
      returning ORDER_ID into l_order_id; 
    
      for rec in(select ID
                      , QTY
                      , PRICE
                  from product)
      loop 
    
        Insert Into Order_Detail ( ORDER_ID
                                  , PRODUCT_ID
                                  , QTY
                                  , UNIT_PRICE)
                            Values(l_order_id
                                  , rec.id
                                  , rec.qty
                                  , rec.price); 
    
        commit;
      end loop;
    end;
    

    Please check and let me know.

    Kind regards

    Jitendra

  • expdp and impdp between TWO different tables

    DBVersion: 10g and 11g

    I have two tables with the same data structure, same columnames and wide except name difference

    orders and order_history

    I got export orders for a date range and now want to import in order_history

    What do I do? If so can you please provide me with the syntax


    Thank you

    REMAP_TABLE:

    http://docs.Oracle.com/CD/E11882_01/server.112/e22490/dp_import.htm#BABIGHCC

  • The selection of two different tables when a value is null or zero in one

    Hi friends,
    I have two tables where the data of...
    so now I have to display the value of tab1.value and if the value that it is) or null I should poster from another table viceversa
    tab1. Value 100 tab2.value 0

    now I get the value of tab1.value

    tab1. Value null tab2.value 200
    now, I should get the value of tab2.value

    If tab1.value is 0 and tab2.value is 0 then display 0

    How to do this

    Thank you
    select  prrv.result_value,
            pg.attribute3,
            case
              when prrv.result_value is null or prrv.result_value = 0 then pg.attribute3,
              else prrv.result_value
            end
    from per_grades pg,pay_run_results prrv
    where prrv.id=pg.id
    /
    

    SY.

  • ListBox cfloop two different tables

    What I try to do is the following:
    On my edit page, I have a listbox that needs to be filled beforehand with those already selected. But here's my problem - I have a table named 'people' and another named "documents". Now the table 'people' have their permissions in it, and the files table has a field that lists people (ie. susie, lisa, jason) who have been selected. So my list box must hit the table of "peoples" to shoot everyone who has the correct permissions (in which case they need to add a person) AND the records in the table so that I can recover that has previously been under. Right now my code looks like this:

    < cfquery name = "qry_people" >
    Select *.
    people
    where permissions = 3
    < / cfquery >

    < cfquery name = "qry_support_people" >
    Select support_people
    records
    where id = #id #.
    < / cfquery >

    < select name = "support_people" multiple >
    < cfloop query = "qry_people" >
    < cfloop list = "" #qry_support_people # "index 'i' = >"
    < option value = "" < cfoutput > #people # < / cfoutput > "< cfif #people # IS i > selected < / cfif > > < cfoutput #people # > < / cfoutput > < / option >"
    < / cfloop >
    < / cfloop >
    < / select >

    Now, it works ALMOST-, he catches all of the "persons" table, AND he says even those who are pre-selected in the table "records"... BUT each name appears TWICE... Why? I tried to change a cfloop to cfoutput, but then I get not the whole list of names. Any help would be great - THANKS!

    Thank you very much - it worked perfectly. I will take your advice to our individual db!

  • How sync 2 passes in two different tables...

    In a form, I had 2 col EMPNO: ENATI...
    EMPNO ENATI
    12 02
    13 12
    14 34
    15 09
    16 10
    It was created using the Assistant DB...

    now, I had another table where this ENATI values are stored... the name of the table is nationality_vu

    IE SQL > select stlename from the nationality_vu where stcode = 018;
    output

    NATIONALITY
    ----------------------
    German

    Now when I create a relationship between table1 and nationality_vu using the Assistant DB (join condition) and specify I want 10 values to be dispalyed in execution, that I only have the nationality of the empno where the cursor is flashing...
    I had even written this code under INSTANCE WHEN_NEW_FORM
    Start
    Select stlename in: enati
    of nationality_vu
    where stcode =: enati;
    exception
    * When no_data_found then *.
    * null; *
    end;

    I want the nationalities to display in place of the code thr... .n I tried several ways using the trial n error but in vain...

    Hello
    And the nationality name is displayed in the element this is the point of non-base of data or a database element?

    If this is the point of non-base of data then u just place your codei trigger after change of the nationality code. It will work.
    Because I did the same job shaped a lot of my system. its fine to work with me.

    -Clément

Maybe you are looking for