473,396 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 5161
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
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,...

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.