473,387 Members | 1,899 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,387 software developers and data experts.

How can i find difference in 2 tables in different databases with same structure

rizwan6feb
108 100+
I am developing an application in VB.net 2005 that synchronizes two mysql databases of same structure. I have done most of the work but having problem in finding the difference in records in 2 tables. Let me explain the scenario

There is a table in the local database having name "user". The same table exists in the online version of the database. I want to find the difference of records in the 2 tables so that i can delete surplus users from the online version of the database. I am trying something like this, which is not working

Expand|Select|Wrap|Line Numbers
  1. DELETE FROM localdb.user
  2. WHERE userid NOT 
  3. IN (
  4. SELECT group_concat( userid
  5. SEPARATOR  ','  ) 
  6. FROM onlinedb.user
  7. )
  8. LIMIT 0 , 30
  9.  

I can't afford to select all the records and then find the difference betwen the 2 tables
May 15 '08 #1
1 2602
Atli
5,058 Expert 4TB
You should be able to simply do:
Expand|Select|Wrap|Line Numbers
  1. DELETE FROM localdb.user
  2. WHERE userid NOT 
  3. IN (
  4.   SELECT userid
  5.   FROM onlinedb.user
  6. )
  7. LIMIT 0 , 30
  8.  
May 15 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Gleep | last post by:
sorry i didn't explain it correctly before my table is like this example fields: ID name username outcome date1 date2 date3 (etc..) - date15 price1 price2 price3 (etc..) I know that...
3
by: Henri | last post by:
Hello, I am quite new to ms-sql and I have a problem : I want to create an SQL request which would copy serveral records from a table in a given database to another table (with exactly the same...
2
by: Richard Trahan | last post by:
I'm running 3.23.54 on Windows 98. I cannot access any tables of a database which previously worked fine and suddenly broke. I get Error 1017 errno: 2 from both mysqlcc 0.9.4 and mysqlc. The...
5
by: Chris | last post by:
Hi, I don't get the difference between a struct and a class ! ok, I know that a struct is a value type, the other a reference type, I understand the technical differences between both, but...
48
by: phillip.s.powell | last post by:
MySQL 3.23.58 - 4.0.17 (yep, several database server instances, don't ask) I have database Spring with table Students I have database Summer with table Students I am tasked to produce a...
18
by: DP | last post by:
hi, i'm designing a video and games rental database. i've got the customer table, with all the correct and relavant details. i've got a films, and games table. But i'm confused which way to...
23
by: Nishant Saini | last post by:
Dear All, We have a database which contains many tables which have millions of records. When We attach the database with MS SQL Server 2005 Standard Edition Server and run some queries (having...
9
by: HC | last post by:
Hello, all, I started out thinking my problems were elsewhere but as I have worked through this I have isolated my problem, currently, as a difference between MSDE and SQL Express 2005 (I'll just...
12
by: Robbo | last post by:
Hi, My database contains 45 tables the structure of which is evolving as I develop. I need a utility that will "read" the structure of this database and it's tables and then create an identical...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.