Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 148
  • Last Modified:

Query question

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
mcrmg
Asked:
mcrmg
  • 3
1 Solution
 
pteranodon72Commented:
SELECT * FROM Table1 WHERE Table1.ID Not In (SELECT ID FROM Table2);
0
 
mcrmgAuthor Commented:
thank you
0
 
mcrmgAuthor Commented:
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
 
mcrmgAuthor Commented:
I think I got it..thx
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now