Full Version: SQL queries
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
monadel
Hi guys,

I have a lil problem here with query.

I have 2 tables. say A & B
in table A I have list number 1 to 8

A: ..... B:
1 ..... 1 01/03/08
2 ..... 8 01/03/08
3 ..... 5 01/03/08
4 ..... 6 01/03/08
5 ..... 2 02/03/08
6 ..... 5 02/03/08
7 ..... 7 02/03/08
8 ..... 8 02/03/08

Then, I want to make a query with a result of all number in A but not in 02/03/08 (Also, I dont want number 5 and 8 as well because they already in 02/03/08). The result must be 1,3,4,6

Can anyone help me please.

Thank you so much.
datAdrenaline
... I am sorry ... but I am not following what you are after .... can you try to explain it again please? ... I know you have table A with numbers 1 through 8 ... but where do the dates come from? ... is "B" a table? or the result you expect?
vtd
It sounds to me that you want the "double negation" method in UA Thread 1608745.

If I understand your requirement correctly, the SQL String should be something like:
CODE
SELECT A.NumberField
FROM A LEFT JOIN
(
  SELECT B.NumberField
  FROM B
  WHERE B.DateField = #2008-03-02#
) AS SQ
ON A.NumberField = SQ.NumberField
WHERE (SQ.NumberField Is Null)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.