Tech Support Guy banner

SQL query ;)

1664 Views 5 Replies 3 Participants Last post by  Rockn
Hi guys,

I'm trying to solve a little sql problem -- I need to cross reference and dump out a list of records that don't belong. The existing query uses a left join between two tables... I need to add some more 'AND' statements in the WHERE line because the query needs to take into account other tables... hence I need to include those tables in the from line. How do I do this, when there is a left join already there?

For example:

SELECT DISTINCTROW tblOne.*
FROM tblOne LEFT JOIN tblTwo ON [tblOne].[item1]=[tblTwo].[item2]
WHERE ((((DatePart("m",[Date])=[Enter Month])) And [tblTwo].[item2] Is Null));

How can I go about adding:

WHERE ........ AND [tblThree].[item3] Is Null AND [tblFour].[item4] Is Null));

To the end of that?

Quick responses will be much, much appreciated.

Thanks guys!
-Sheist
Status
Not open for further replies.
1 - 2 of 6 Posts
You need to also have the other tables in the SELECT and the fields in the FROM portiont of the query with the appropriate joins as well.
If you are not sure the results are correct you will never get the query right. Can you put in some canned data you know the values will come out correct for and base your query on thoes?
1 - 2 of 6 Posts
Status
Not open for further replies.
Top