Compare two value table
I want to compare two table value is the same, the result I want is can alert 1,5,6, but the result is now only 6
var myText1 = "1,3,5,6."
var myText2 = "+ 1, + 2, 3, + 4, + 5";
var array1 = myText1.split(",");
var array2 = myText2.split(",");
for (var i = 0; i < array1.length; i ++) {}
~ alert (array2.toString (.valueOf (array1 [i])));
If (array2. ToString(). IndexOf (array1 [i]) ==-1) {}
Alert ("havn't" + array1 [i]);
}
}
Hello
Delete "var" on line 14
1,5,6 on my side...
Jarek
Tags: InDesign
Similar Questions
-
Stored procedure to compare two data tables
Hello
I want to have a stored procedure that will compare two tables data (only one column) and remove the line that is not present in the second table.
For example.,.
I have 2 tables called Table1 and Table2, that have the same column called ID (PK).
Data in Table1 are 1,2,3 and data into Table2 are 1.3. When the stored procedure is running, it must compare the ID column in Table1 to ID column in Table2 and since '2' is not there in Table2, I want to remove this line from Table1.
Thanks in advance.delete from table1
where does not exist (select 1 from table2 where table2.id = table1.my_field)
; -
Hello
do we not have a function to compare two values of type varchar column.
I have a table tab1
I'm trying to store the result in a view...col1 col2 abc abc cde cde efg aba ghi ikl abc abc
How can this be achieved through the function or query.col1 col2 diff abc abc true cde cde true efg aba false ghi ikl false abc abc true
Thank you.BTW, all the posted solution do not consider NULL values:
SQL> with t as ( 2 select 'abc' col1,'abc' col2 from dual union all 3 select 'cde','cde' from dual union all 4 select 'efg','aba' from dual union all 5 select 'ghi','ikl' from dual union all 6 select 'ghi',null from dual union all 7 select null,'ikl' from dual union all 8 select null,null from dual union all 9 select 'abc','abc' from dual 10 ) 11 select col1, 12 col2, 13 nvl2(regexp_replace(col1,'^' || col2 || '$'),'false','true') sy, 14 case when col1=col2 then 'true' else 'false' end arun_Centinul_hoek, 15 DECODE(col1, col2, 'true', 'false') Himanshu 16 from t 17 / COL1 COL2 SY ARUN_CENTINUL_HOEK HIMANSHU ---- ---- ----- ------------------ -------- abc abc true true true cde cde true true true efg aba false false false ghi ikl false false false ghi false false false ikl true false false true false true abc abc true true true 8 rows selected. SQL>
SY.
-
I want to compare two tables and out a boolean
This should be simple. I want to compare two tables (5 items) and return a single Boolean value (T/F), not an array of Boolean.
Thank you
Kevin
Right click on the comparison, the comparison mode, select compare the aggregates.
-
Compare two tables, APEX
Hello
I am trying to compare two tables, but I want to display values that are the differnet from one to the other,
both tables have the same columns and have the same PK.
Thank you.Hello
You probably need a report based on a query like this:
SELECT d1.deptno, d1.dname, d2.dname, d1.loc, d2.loc FROM dept1 d1 INNER JOIN dept2 d2 ON d1.deptno = d2.deptno AND ( d1.dname <> d2.dname OR d1.loc <> d2.loc )
You can also consider using FULL JOIN where you have different values of primary key in both tables and you want to include in the report.
-
Compare two rows in the same table
Hi all
I need to compare two rows in the same table, I don't know hoe to do it in pl/sql. Please help me on this.
example:
price of ro TR
xya0001 AMA.7 12
xya0003 ama6 14
xya0004 AMA.7 16
in table b is a unique value for each line, I need to compare the price column and see if the first value is less than or greater than the following value and, if there is more to put the corresponding value of br to a variable, and if it is less, put the corresponding value of the br to another variable. I don't know a method to do this, as I'm new to pl/sql. Please help me in thisfor data in(select tr,br,price, lag(price) over ( order by tr) newcol from yourtable) loop if nvl(data.newcol,0) > data.price then variable1:=data.br; else varable2:=data.br; end if; end loop;
-
BUG? Statement of BRIDGE to compare two tables
Hello
I tried to compare two tables different dbs and remembered a post on applications to Connectin Cross
http://barrymcgillin.blogspot.com/2010/11/cross-connection-queries.html
I expect to get the differences between the ARB table in my current schema and the table alias temparb arb in the other db. Yet it seems that in this case only the table in my current schema is read.BRIDGE temparb AS "EB05 01" (SELECT * FROM arb) (SELECT * FROM temparb MINUS SELECT * FROM arb ) UNION ALL (SELECT * FROM arb MINUS SELECT * FROM temparb );
I materialize at the table BRIDGE with
and select the value that I know to be only in the remote schemaBRIDGE temparb AS "EB05 01" (SELECT * FROM arb)
Both times I get no results. I even tried to use aliases on the table, same result. Tested in EA3 3.0 and 3.1.SELECT id FROM temparb WHERE id = 2562; SELECT id FROM arb WHERE id = 2562;
Has anyone tried this before?
Concerning
MarcusHi Marcus,
Have you tried without the quotes around the name of connection?
I have a named connection
system_local
which I run the following commanddrop table testbridge_remote;
drop table testdbrige;
create table testbridge (col1 int);
insert into testbridge values (1);
insert into testbridge values (2);
insert into testbridge values (3);
commit;I have a named connection
Name of the connection with space
I performed the following in thedrop table testdbrige;
create table testbridge (col1 int);
insert into testbridge values (4);
insert into testbridge values (5);
insert into testbridge values (3);
commit;Then I can execute the following statement in the connection of system_local/worksheet
BRIDGE testbridge_remote as the name of connection with Space(select * from testbridge)
+ (SELECT * FROM testbridge_remote +)
LESS
SELECT * from testbridge
+)+
UNION ALL
+ (SELECT * FROM testbridge +)
LESS
SELECT * from testbridge_remote
+);+It works well.
Returns the rows in the remote table not in the local table and lines in the local table, not the remote table.Kind regards
Dermot
SQL development team. -
Hello
I need to compare two tables (T1, T2) and update existing records only in T2, but not in T1. So basically, the lines updated in T2:
Select * from T2 where T2.id not in (select id from T1).
What would be a good way to achieve this in ODI?
I created an ODI interface with a join T2.id not in T1.ID, but it did not work "coz:" ORA-01427: einreihig subquery returns several lines "."
Appreciate any input/access map.
Thank you.Hi Michele...
At first glance, there are at least 2 ways to do it:
(1) put the steps in "(select id from T1)" (you can use an ODI API to get the schema dynamically) as an object filter to T2 (interface), use the incremental update IKM SQL and put "Insert" option on 'No'. " This will do a few updates.
OR
(2) in an interface set the T1 and T2 and left join (based on T2) load a temp table where all fields accept the value zero. Next to the columns to update (of course the T2), create an ID column (I named him as T1_Temp_ID) and map the Id of the T1 to it.
Now just create new interface where the temperature is source and put a filter like "T1_Temp_ID is not null.The first option is less complex and can bring better performance.
The second option gives a better follow-up of the use of the table and the columns, but can be less performatique.This help you?
-
compare two table with cluster inside
Hello
I want to compare two tables containing a cluster with several groups in it. When you use the equal the result is the same pattern as the cluster of entry. But I just need a true or false. It doesn't bother me that it changed on position 1 or any other position.
Is there an elegant way to do it?
Thanks for any help.
Yves
Right-click equality and change to compare aggregations. That, or add a table and later.
/Y
-
Disqualification: Compare the value list in another Table
I'm relatively new to the Disqualification.
I use the 11.1.1.7 version.
I have 2 tables Oracle. Table1.FieldA does not have a foreign key constraint (but should be) at Table2.FieldB.
I created a snapshot for Table1 that includes FieldA.
I created another cliché to Table2 which includes FieldB.
I am trying to compare the Table1.FieldA with Table2.FieldB value to make sure that there is.
I can think of a few processors that I could, but they seem to compare a value with another value in the same snapshot (table).
Any advice would be helpful.
Thank you.Ray
Hello
Use the search check if you want to just check between the tables. According to the reference database, you need create a list of choices on the table (can be either staged as you, or just a list of external choice provided the lookup columns are indexed). Use Lookup and return if you want to import data in the other table in your process. You can control if you want a 1:1 or from a 1:M relationship, and if you go back several records, you can use split chronogram: table with all the paintings of entry to create an intermediate join process.
Mike
-
Retrieve two values of column in a table
Hi I want to retrieve two values of column in a table and store the values as a single column value in another table... How to do with it?Use in this way:
Insert in tab2 (col1) select col1 | col2 from tab1; -
By comparing the two huge table columns
Hello
I want to compare two tables each of RECON_APPEND_01 table contains 375 million and RECON_VS_24082011 450 million records.
RECON_APPEND_01 is a normal table and RECON_VS_24082011 is range partitoned table.
The two table has a primary key on the column Serial_number. (Oracle 11g R2)
Requirment is to obtain the records in the RECON_APPEND_01 table that are not present in RECON_VS_24082011.
I came across a few suggestions for using operator less. Here is the query and its plan to explain
Explain the Plan:CREATE TABLE RECON_APPEND_01 PARALLEL 3 NOLOGGING AS ( SELECT SERIAL_NUMBER FROM RECON_APPEND_01 minus select SERIAL_NUMBER from RECON_VS_24082011 )
Another alternate query:-------------------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| TQ |IN-OUT| PQ Distrib | -------------------------------------------------------------------------------------------------------------------------- | 0 | CREATE TABLE STATEMENT | | 378M| 6451M| | 1398K (43)| | | | | 1 | PX COORDINATOR | | | | | | | | | | 2 | PX SEND QC (RANDOM) | :TQ10002 | | | | | Q1,02 | P->S | QC (RAND) | | 3 | LOAD AS SELECT | RECON_APPEND_03 | | | | | Q1,02 | PCWP | | | 4 | MINUS | | | | | | Q1,02 | PCWP | | | 5 | SORT UNIQUE | | 378M| 4336M| 7255M| 775K (4)| Q1,02 | PCWP | | | 6 | PX RECEIVE | | 378M| 4336M| | 114K (3)| Q1,02 | PCWP | | | 7 | PX SEND HASH | :TQ10000 | 378M| 4336M| | 114K (3)| Q1,00 | P->P | HASH | | 8 | PX BLOCK ITERATOR | | 378M| 4336M| | 114K (3)| Q1,00 | PCWC | | | 9 | TABLE ACCESS FULL | RECON_APPEND_01 | 378M| 4336M| | 114K (3)| Q1,00 | PCWP | | | 10 | SORT UNIQUE | | 184M| 2115M| 3539M| 538K (3)| Q1,02 | PCWP | | | 11 | PX RECEIVE | | 184M| 2115M| | 216K (1)| Q1,02 | PCWP | | | 12 | PX SEND HASH | :TQ10001 | 184M| 2115M| | 216K (1)| Q1,01 | P->P | HASH | | 13 | PX BLOCK ITERATOR | | 184M| 2115M| | 216K (1)| Q1,01 | PCWC | | | 14 | INDEX FAST FULL SCAN| SYS_C002617302 | 184M| 2115M| | 216K (1)| Q1,01 | PCWP | | --------------------------------------------------------------------------------------------------------------------------
Explain the Plan:CREATE TABLE recon_append_02 PARALLEL 3 NOLOGGING AS SELECT * FROM RECON_APPEND_01 a WHERE NOT EXISTS (SELECT 'X' FROM RECON_VS_24082011 b WHERE b.SERIAL_NUMBER = a.SERIAL_NUMBER)
Based on the plan I've run the second query, but it's taking a lot of time around 4 hours and still running.------------------------------------------------------------------------------------------------------------ | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| TQ |IN-OUT| PQ Distrib | ------------------------------------------------------------------------------------------------------------ | 0 | CREATE TABLE STATEMENT | | 378M| 26G| 450K (10)| | | | | 1 | PX COORDINATOR | | | | | | | | | 2 | PX SEND QC (RANDOM) | :TQ10000 | 378M| 26G| 153K (28)| Q1,00 | P->S | QC (RAND) | | 3 | LOAD AS SELECT | RECON_APPEND_02 | | | | Q1,00 | PCWP | | | 4 | NESTED LOOPS ANTI | | 378M| 26G| 153K (28)| Q1,00 | PCWP | | | 5 | PX BLOCK ITERATOR | | | | | Q1,00 | PCWC | | | 6 | TABLE ACCESS FULL| RECON_APPEND_01 | 378M| 22G| 116K (5)| Q1,00 | PCWP | | | 7 | INDEX UNIQUE SCAN | SYS_C002617302 | 1 | 12 | 0 (0)| Q1,00 | PCWP | | ------------------------------------------------------------------------------------------------------------
Please suggest.
With respect,
Adeline FaureLook carefully at the request of Tubby. Your problem in your test is with b.val = null. You can't compare anything on a null using normal operators.
SQL> select * from target_tab; VAL ---------- 1 2 3 4 5 6 7 8 9 10 SQL> select * from source_tab; VAL ---------- 6 7 8 9 10 SQL> select a.* 2 from target_tab a, source_tab b 3 where a.val = b.val(+) and 4 b.val is null; VAL ---------- 5 1 4 2 3
John
-
How to compare the value of two combo
I have two Combo Box (cbFirst & cbSecond). I want to compare the value that has been selected by the user and according to the result, the output is displayed. In the two combo box, I have provided the value.
Here is my code:
var a: number;
var b:Number;function First(evt:Event):void {}
a = evt.target.value;
trace (a);
}
cbFirst.addEventListener (Event.CHANGE, first);function Second(evt:Event):void {}
b = evt.target.value;
trace (b);
}
cbSecond.addEventListener (Event.CHANGE, second);If (a > b) {}
trace ("more")
on the other
trace (b is higher);
Trace the statement inside the functions work very well and the value correct a & b is printed. But the comparison in the if statement does not seem to work. Could you please help me.
There is a typing error. Fix it or delete it:
var a: number;
var b:Number;function First(evt:Event):void {}
a = evt.target.value;trace (a);
compareF();
}
cbFirst.addEventListener (Event.CHANGE, first);function Second(evt:Event):void {}
b = evt.target.value;
trace (b);compareF()
}
cbSecond.addEventListener (Event.CHANGE, second);function compareF() {}
If (a > b) {}
trace ("more")
on the other
trace (b is higher);
}
-
Hello
can you please help me.
How can I compare two table. following my code...
var my_array:Array = Array (5,10,15,20,25,30)
var new_array:Array = Array (7,8,9,10,11,12,13)
for (var i: Number = 0; i < my_array.length; i ++) {}
{if(my_array[i]==new_array[i])}
trace (my_array [i])
}
}Thanks in advance,
JaxNa
Then, you're almost on correct... See the same code that I modified a little,
var my_array:Array = Array (5, 10, 15, 20, 25, 30);
var new_array:Array = Array (7, 10, 9, 10, 10, 30, 13);for (var i: Number = 0; i
If (my_array [i] is {new_array [i]})
trace ("' my Array'" + i + "("+my_array[i]+")"new_array' "+ i +"("+new_array[i]+") = Matching");
} else {}
trace ("' my Array'" + i + "("+my_array[i]+") 'new_array'" + i + "("+new_array[i]+") = is only not to");
}
}If this is not so, explain exactly what you want
-
The column that does not match when comparing two records
Hi all
We try to compare two tables and find the differences. So if two records (1 of each table) have same PK but not always matching because of some columns, then we would display this columnname. For example:
Table 1
PK Parent Child Property1 Property2 1 A A1 P1 PR1 2 B B1 P2 oraPR2 3 C C1 P3 SRP Table 2
PK Parent Child Property1 Property2 1 A A1 P1 PR1 2 B B1 P2 PR2 3 C C1 P3 PR4 In the above example when I compare 2 tables all matches except Property2 online n ° 3. Thus, we would like to get an output like:
PK Column_Mismatch 3 Property2 (this must be the name of the column that does not match) Appreciate the help.
Thank you
Andy
Hi, Andy.
Andy1484 wrote:
Hi all
We try to compare two tables and find the differences. So if two records (1 of each table) have same PK but not always matching because of some columns, then we would display this columnname. For example:
Table 1
PK Parent Child Property1 Property2 1 A A1 P1 PR1 2 B B1 P2 oraPR2 3 C C1 P3 PR3 Table 2
PK Parent Child Property1 Property2 1 A A1 P1 PR1 2 B B1 P2 PR2 3 C C1 P3 PR4 In the above example when I compare 2 tables all matches except Property2 online n ° 3. Thus, we would like to get an output like:
PK Column_Mismatch 3 Property2 (this must be the name of the column that does not match) Appreciate the help.
Thank you
Andy
Why you don't want no matter what exit for pk = 2? Property2 does not correspond either to pk.
What happens if the 2 columns (or more) do not match? The following query would produce a list delimited, such as ' parents; PROPERTY2 '.
WITH got_mismatch AS
(
SELECT pk
, CASE WHEN t1.parent <> t2.parent THEN '; PARENT' END
|| CASE WHEN t1.child <> t2.child THEN '; CHILD ' END
|| CASE WHEN t1.properry1 <> t2.property1 THEN '; PROPERTY1 ' END
|| CASE WHEN t1.properry2 <> t2.property2 THEN '; PROPERTY2 ' END
AS the offset
FROM table_1 t1
JOIN table_2 t2 ON t2.pk = t1.pk
)
SELECT pk
, SUBSTR (incompatibility, 3) AS column_mismatch
OF got_mismatch
WHERE mismatch IS NOT NULL
;
If you would care to post CREATE TABLE and INSERT statements for your sample data, and then I could test this.
The query above does not count NULL values as inadequate. If you want that, the same basic approach will work, but you can use DECODE instead of <> to compare columns.
What happens if a pk exist in a table, but not the other? You want an outer join, where I used an inner join above.
Maybe you are looking for
-
The message of ff for me, is "to protect users information, unprivileged scripts cannot invoke the commands cut, copy, and paste in the Mozilla rich text editor... to activate these features, you must change your browser preferences... "This is an on
-
I have a home business and I need to download cbsurge on the desktop by using firefox as default browser. I get firefox as default browser but it won't let me save to the desktop... at my whits on what... would be - that one of my settings and if so
-
Can I use my Mini 200 for anything without recovery disk?
Hello I ve had 200-4200 Mini. A few months back I had a hard drive crash and another was sent by the warranty. I m abroad, so he was sent to my friend, who sent me to the Nicaragua. The drive arrived, BUT pick it up USB does not stick. (they came sep
-
Have had many error messages and slow down computer ops for several weeks.
-
Error every time I try to add an MP3 song to Movie Maker, I bought from Amazon.
I try to add a song to a movie maker slideshow. Whenever I have add the song, the program crashes and says that I can't see a preview. How can I add an MP3 song, I bought from Amazon. I use Windows 7. Thank you