SQL help

M

MikeR

For my Jet database I have a query that almost works, but I can't get the last piece
right.

SELECT C_List.CID, C_List.LName FROM (C_List LEFT JOIN Alias ON C_List.CID =
Alias.CID) LEFT JOIN AWARD ON C_List.CID = AWARD.ACID WHERE (((AWARD.ACID) Is Null)
AND ((Alias.Date_To)Is Null)) GROUP BY C_List.CID, C_List.LName ORDER BY C_List.CID;

The Alias table has a yes/no field named 'deleted'. I need to exclude records from
the return set where that field is true.

Thanks, Mike
 
D

Dirk Goldgar

MikeR said:
For my Jet database I have a query that almost works, but I can't get the
last piece right.

SELECT C_List.CID, C_List.LName FROM (C_List LEFT JOIN Alias ON C_List.CID
= Alias.CID) LEFT JOIN AWARD ON C_List.CID = AWARD.ACID WHERE
(((AWARD.ACID) Is Null) AND ((Alias.Date_To)Is Null)) GROUP BY C_List.CID,
C_List.LName ORDER BY C_List.CID;

The Alias table has a yes/no field named 'deleted'. I need to exclude
records from the return set where that field is true.


How about:

SELECT
C_List.CID, C_List.LName
FROM
(C_List LEFT JOIN Alias ON C_List.CID = Alias.CID)
LEFT JOIN AWARD ON C_List.CID = AWARD.ACID
WHERE AWARD.ACID Is Null
AND Alias.Date_To Is Null
AND (Alias.Deleted = 0 OR Alias.Deleted Is Null)
GROUP BY C_List.CID, C_List.LName
ORDER BY C_List.CID;
 
M

MikeR

Dirk said:
How about:

SELECT
C_List.CID, C_List.LName
FROM
(C_List LEFT JOIN Alias ON C_List.CID = Alias.CID)
LEFT JOIN AWARD ON C_List.CID = AWARD.ACID
WHERE AWARD.ACID Is Null
AND Alias.Date_To Is Null
AND (Alias.Deleted = 0 OR Alias.Deleted Is Null)
GROUP BY C_List.CID, C_List.LName
ORDER BY C_List.CID;
Perfect!
Thanks, Dirk
 
M

MikeR

Dirk said:
How about:

SELECT
C_List.CID, C_List.LName
FROM
(C_List LEFT JOIN Alias ON C_List.CID = Alias.CID)
LEFT JOIN AWARD ON C_List.CID = AWARD.ACID
WHERE AWARD.ACID Is Null
AND Alias.Date_To Is Null
AND (Alias.Deleted = 0 OR Alias.Deleted Is Null)
GROUP BY C_List.CID, C_List.LName
ORDER BY C_List.CID;
PERFECT!
Thanks Dirk

Not sure where my reply went, so if the is a dupe, I'm sorry.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top