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

How to get the difference between two similar tables (complement)

1,059 1GB
Dear All,
I am having a bit problem with a simple development.
I am not into Queries but I need this.
Lets follow the example below

tble1
---------------------------------
| ID | Name
---------------------------------
| 1 | johny
---------------------------------
| 2 | rony
---------------------------------
| 3 | Anne
---------------------------------

tbl2
---------------------------------
| ID | Name
---------------------------------
| 1 | johny
---------------------------------
| 3 | Anne
---------------------------------

I need the query of complement: The returned result would be
---------------------------------
| ID | Name
---------------------------------
| 2 | rony
---------------------------------

Please I need the solution
Best Regards,
Johny
Jul 10 '10 #1
2 3850
We need more information like whats the fields called and what your trying to do exactly?
Jul 10 '10 #2
johny10151981
1,059 1GB
The query would be,

Expand|Select|Wrap|Line Numbers
  1. SELECT M.ID
  2. FROM tble1 AS M
  3. WHERE M.ID NOT
  4. IN (
  5. SELECT P.ID
  6. FROM tbl2 AS P
  7. )
  8.  
Regards,
Johny
Jul 11 '10 #3

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

Similar topics

0
by: Vijoy Varghese | last post by:
Hi Friends, I am kinda stuck with a SQL query, can some one please guide me? I have two 'similar' tables a) open_works_table b) closed_works_table now, closed_works_table have 2 extra fields...
5
by: Rick Clift | last post by:
I have two tables in my database called CartItems and OrderItems. I store all of a session's shopping cart items in the CartItems table using the sessionID as the identifier (called cartID in my...
2
by: php newbie | last post by:
Hello, I am relatively new to SQL Server, although I have used Oracle extensively. In Oracle, there are system tables that you can query in order to get a list of all schemas and all the...
2
by: AzGhanv/. | last post by:
Hi, I m searching for some Script / Function ... to find difference in data b/w 2 similar tables (exactly same fields structure) in sql 2000. plz update me asap ! thanks in advance !
5
by: Megan | last post by:
Hi everybody- I'm helping a friend with a music database. She has an old one and is creating a new one. She wants to compare records and fields in the old database with records and fields in the...
4
by: steves | last post by:
Hello All, I am trying to link to an existing database and extend the funcitonality by adding a phone call logging extension, so you can see a list of phone calls for a given customer. There...
1
by: charvi | last post by:
i have a same table in two different locations i want to add the contents of 1 table to another in access how can i do for eg i have a table customer in db1 and same table in db2 i want to...
1
by: keleathi | last post by:
I'm pulling in data from two servers over two SSH tunnels. The tables on each of the servers have the same fields, 8 in total. I need a way to see if an entry that is in the first server is also on...
1
by: keveen | last post by:
Can someone tell me how I can import tables from another non-Joomla mysql file into Joomla? Basically it is just from one mySQL database into another. I use phpMyAdmin to import and export the entire...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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
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
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...

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.