473,467 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

sql comparison and flag

I need to compare two tables and print the differences(vbscript). Is
there a quick sql way to do this. Otherwise I have a O(n^2) problem.

What I am doing now is getting the data from the 2nd table first and
then printing the 1st table and checking if the value matches the 2nd
table. O(n^2)

lets say I have ids

Get Table 2 data

3 4 5

Print Table 1 and Flag:

1 - no O(n)
2 - no O(n)
3 - yes O(n)
4 - yes O(n)
5 - yes O(n)
6 - no O(n)

Is there a better way?
Jul 19 '05 #1
3 5164
bigbinc wrote:
I need to compare two tables and print the differences(vbscript). Is
there a quick sql way to do this. Otherwise I have a O(n^2) problem.

What I am doing now is getting the data from the 2nd table first and
then printing the 1st table and checking if the value matches the 2nd
table. O(n^2)

lets say I have ids

Get Table 2 data

3 4 5

Print Table 1 and Flag:

1 - no O(n)
2 - no O(n)
3 - yes O(n)
4 - yes O(n)
5 - yes O(n)
6 - no O(n)

Is there a better way?


Define better.

(SELECT * FROM TABLE1
MINUS
SELECT * FROM TABLE2)
UNION
(SELECT * FROM TABLE2
MINUS
SELECT * FROM TABLE1)

Jul 19 '05 #2
"Anna C. Dent" <an******@hotmail.com> wrote in message news:<BlCmb.84886$Ms2.45276@fed1read03>...
bigbinc wrote:
I need to compare two tables and print the differences(vbscript). Is
there a quick sql way to do this. Otherwise I have a O(n^2) problem.

What I am doing now is getting the data from the 2nd table first and
then printing the 1st table and checking if the value matches the 2nd
table. O(n^2)

lets say I have ids

Get Table 2 data

3 4 5

Print Table 1 and Flag:

1 - no O(n)
2 - no O(n)
3 - yes O(n)
4 - yes O(n)
5 - yes O(n)
6 - no O(n)

Is there a better way?


Define better.

(SELECT * FROM TABLE1
MINUS
SELECT * FROM TABLE2)
UNION
(SELECT * FROM TABLE2
MINUS
SELECT * FROM TABLE1)


Well, lets just say I have 200 records in one table and 200 records in
another table, that is 200 * 200 calculations. Between
vbscript,oracle, my-brain, and somebody else's brain, there is
probably a better way.
Jul 19 '05 #3


bigbinc wrote:
"Anna C. Dent" <an******@hotmail.com> wrote in message news:<BlCmb.84886$Ms2.45276@fed1read03>...
bigbinc wrote:
I need to compare two tables and print the differences(vbscript). Is
there a quick sql way to do this. Otherwise I have a O(n^2) problem.

What I am doing now is getting the data from the 2nd table first and
then printing the 1st table and checking if the value matches the 2nd
table. O(n^2)

lets say I have ids

Get Table 2 data

3 4 5

Print Table 1 and Flag:

1 - no O(n)
2 - no O(n)
3 - yes O(n)
4 - yes O(n)
5 - yes O(n)
6 - no O(n)

Is there a better way?


Define better.

(SELECT * FROM TABLE1
MINUS
SELECT * FROM TABLE2)
UNION
(SELECT * FROM TABLE2
MINUS
SELECT * FROM TABLE1)

Well, lets just say I have 200 records in one table and 200 records in
another table, that is 200 * 200 calculations. Between
vbscript,oracle, my-brain, and somebody else's brain, there is
probably a better way.


There is a better way,
but you have to think smarter rather than a brute force.

If you can read from table1 & table2 in the same order,
then only 1 full table scan of each table is required.

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Andreas Koch | last post by:
Hi all, i started a little "practical language comparison" - practical in the sense that i compare how actual distributions and versions and their libraries (not abstract language...
3
by: Jim Archer | last post by:
Hi All... I'm been fighting this problem for a few days now, and it seems like it should be simple. But the solution has eluded me so far... I need to flag a record when it is updated or when...
1
by: starffly | last post by:
In my program, the calculated value is supposed to be no more than the constants named MAXINT,otherwise, the overflow error will be reported, however, I cannot test if the value exceeds MAXINT...
4
by: Bucco | last post by:
I am trying to compare a list of items to the list of files generated by os.listdir. I am having trouble getting this to work and think I may be going down the wrong path. Please let me know if...
7
by: matt | last post by:
hello, i have been given a challenging project at my org. i work on an inventory management web application -- keeping tracking of parts assigned to projects. in the past, i built an in-house...
9
by: atbusbook | last post by:
I'm doing a report on the speed of develipment and executionin varius programing langiuiges. write code for all these tasks in the languige of your choise if intrestied send code to...
3
by: Russ | last post by:
I posted a message on this several days ago, but it apparently got lost in googlespace, so I'll try it again. I recently discovered a bug in my code that apparently resulted from the automatic...
12
by: Daniel Earwicker | last post by:
I wrote two trivial test programs that do a billion iterations of a virtual method call, first in C# (Visual Studio 2005): Thing t = new DerivedThing(); for (System.Int64 n = 0; n < 10000000000;...
2
by: bigbinc | last post by:
I need to compare two tables and print the differences(vbscript). Is there a quick sql way to do this. Otherwise I have a O(n^2) problem. What I am doing now is getting the data from the 2nd...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.