Solved

Query question

Posted on 2008-10-15
4
142 Views
Last Modified: 2012-05-05
hi,

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
thx
0
Comment
Question by:mcrmg
  • 3
4 Comments
 
LVL 14

Accepted Solution

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

Author Comment

by:mcrmg
ID: 22721276
thank you
0
 

Author Comment

by:mcrmg
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)
and
Table1.month(D1) Not In (SELECT month(D1) FROM Table2)


? it does not work...
0
 

Author Comment

by:mcrmg
ID: 22723869
I think I got it..thx
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

As they say in love and is true in SQL: you can sum some Data some of the time, but you can't always aggregate all Data all the time! Introduction: By the end of this Article it is my intention to bring the meaning and value of the above quote to…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…

821 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