Query question

Posted on 2008-10-15
Last Modified: 2012-05-05

I have two tables
Table1         Table2
ID   F1          ID      F1
1    aa          1       gg
2    bb          3       hh
3    cc          4       oo
4    dd          
5    ee          

My question is, how can I write a query that can display 2 and 5 from Table1
Question by:mcrmg
  • 3
LVL 14

Accepted Solution

pteranodon72 earned 80 total points
ID: 22721257
SELECT * FROM Table1 WHERE Table1.ID Not In (SELECT ID FROM Table2);

Author Comment

ID: 22721276
thank you

Author Comment

ID: 22723856
sorry that the question is closed, if I need to add another condition to it

SELECT * FROM Table1 WHERE Table1.year(D1) Not In (SELECT year(D1) FROM Table2)
Table1.month(D1) Not In (SELECT month(D1) FROM Table2)

? it does not work...

Author Comment

ID: 22723869
I think I got it..thx

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now