Difficult LEFT JOIN Prob

  • Thread starter Thread starter danprhayes
  • Start date Start date
D

danprhayes

Guest
SELECT Wards.Wards FROM Wards LEFT JOIN Returns ON Wards.Wards = Returns.TheWard WHERE (((Returns.TheWard) Is Null)) ORDER BY Wards.Wards

Using the SQL above on the following tables:

Wards containing field Wards
Returns containing many fields including TheWard and TheMonth

Wards is a list of all areas that I should recieve a monthly input from. Returns contains those inputs and so I use this SQL to tell me which wards have not submitted BUT I cannot define TheMonth to say March for example.

Help!

Many thanks
 
SELECT Wards.Wards FROM Wards LEFT JOIN (Select * From Returns Where [TheMonth]="March") ON Wards.Wards = Returns.TheWard WHERE (((Returns.TheWard) Is Null)) ORDER BY Wards.Wards
 
Syntax error

That was a quick reply and it looked good but I get a "Syntax error in JOIN operation"

Tried it in access as raw sql (copy and pasted) and on a web page through asp.

Do you know why this might be..?
 
SELECT Wards.Wards FROM Wards LEFT JOIN (Select * From Returns Where [TheMonth]="March") AliasName ON Wards.Wards = AliasName.TheWard WHERE (((AliasName.TheWard) Is Null)) ORDER BY Wards.Wards

Forgot the AliasName on the Recordset
 
Thank you Travis!

Travis...

It works like a dream! Thank you very much! The best, most useful, quickest response I have ever had from any forum...

Pat yourself on the back and have a nice healthy long life full of love and riches.

Daniel
 

Users who are viewing this thread

Back
Top Bottom