August 1st, 2009, 07:05 PM #1
- Join Date
- Mar 2005
Database: Comparing values in two different tables
I hope someone can answer this question!
I am trying to compare two columns from a table with one column from another table. I need to have the rows from the first table that aren't contained in the second table.
The "problem" is that I have around 800K records on each table.
Has anyone tried to do this in a home computer (2 Gb RAM 1.79 GHz Centrino Duo)?
If you have, how long did it take?
If you haven't, what's your guess? How long will it take?
The DBMS is MySQL running on Windows.
Thank you all!!!
August 1st, 2009, 07:43 PM #2
- Join Date
- Oct 2001
how long it will take is heavily dependant on if the columns are indexed
I think mysql now supports 'join' syntax?
you could do something as simple as
left outer join t2
on t1.column1 = t2.column1
obviously changing the table/column names
this is written for t-sql so some minor syntax changes maybe necessary for mysql
what you're asking for is a pretty common outer join
it maybe a right outer join, so if left doesn't give you the correct results try a right outer joinHelicopters don't fly; they vibrate so much and make so much noise that the earth rejects them.
August 9th, 2009, 09:58 AM #3Code:
I've always done: select t1.column1, t1.column2 from table t1 where not exists (select 'x' from table t2 where t1.column1 = t2.column and t1.column2 = t2.column)
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
By TheBigCarp321 in forum Processors, Memory, and OverclockingReplies: 5Last Post: May 2nd, 2006, 10:13 PM
By hav0c in forum Storage RelatedReplies: 1Last Post: January 5th, 2006, 04:41 AM
By Theophylact in forum IMO CommunityReplies: 7Last Post: March 9th, 2004, 02:15 AM
By washe in forum Graphic Design and Digital PhotographyReplies: 3Last Post: August 12th, 2002, 07:17 PM