SQL Confusion

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi!
Im having trouble formulating and SQL Query, basically cause Im not very
good at it.. I think it should be a standard, simple bit of SQL for someone
who knows what they are doing, although my explaination below looks
complicated
thanks very much for any help you can give:

I have 2 tables, table1 and table2
Both tables have columns called App, type and status
I want to return rows from both tables where there is not a row in the other
table in which these fields match.
eg if table1 has a row:
app ="access", type="PC", status="On"
and table 2 does not have a single row where these 3 fields have the same
values then I would want to return the row from table1.

Thankyou so much, hope I have explained this ok!
 
This will get you started. Create a new query in design view, do not select
any tables, close the table selector window, and change the view to SQL view
(icon at top left of window on toolbar). Paste this SQL statement into that
window.

SELECT table1.*
FROM table1
LEFT JOIN table2
ON Nz(table1.app,"") = Nz(table2.app,"") AND
Nz(table1.type,"") = Nz(table2.type,"") AND
Nz(table1.status,"") = Nz(table2.status,"")
WHERE table2.app IS NULL;
 
Back
Top