Query Logic

K

K Dales

Simplified, try:
(([TA ID]<>53) AND ([TA_ID]<>1) AND NOT(([TA ID]=43) AND
([Disposal Date] BETWEEN Date1 AND Date2)))

-----Original Message-----
I have the following query. In addition to excluding
records with TA ID = 53 and 1, I would like to exclude
records with TA ID = 43 IF the records fall in a specific
year. I'm not sure how to incorporate this logic (if
statement) in the query. Can someone help?
SELECT [Waste Origin, Type, Destination, and Volume].
[Container-Item ID], [Waste Origin, Type, Destination, and
Volume].[Disposal Date], [Waste Codes].[Waste Code],
[Waste Forms].[Waste Form], [Waste Volume]*[Waste Form
Fraction] AS [Total Volume], Sum([Activity]*[Waste Form
Fraction]) AS [Total Activity], [Total Volume]/7*12 AS
[Extrapolated Volume], [Total Activity]/7*12 AS
[Extrapolated Activity], [Waste Origin, Type, Destination,
and Volume].[TA ID]
FROM (([Waste Codes] INNER JOIN [Waste Forms] ON [Waste
Codes].[Waste Code] = [Waste Forms].[Waste Code]) INNER
JOIN [Waste Origin, Type, Destination, and Volume] ON
[Waste Codes].[Waste Code] = [Waste Origin, Type,
Destination, and Volume].[Waste Code]) INNER JOIN [Waste
Activities] ON [Waste Origin, Type, Destination, and
Volume].[Container-Item ID] = [Waste Activities].
[Container-Item ID]
WHERE ((([Waste Origin, Type, Destination, and Volume].
[Disposal Date]) Between #1/1/1971# And #12/31/1977#))
GROUP BY [Waste Origin, Type, Destination, and Volume].
[Container-Item ID], [Waste Origin, Type, Destination, and
Volume].[Disposal Date], [Waste Codes].[Waste Code],
[Waste Forms].[Waste Form], [Waste Volume]*[Waste Form
Fraction], [Waste Origin, Type, Destination, and Volume].
[TA ID], [Waste Origin, Type, Destination, and
Volume].MDA, [Waste Origin, Type, Destination, and
Volume].Pit
HAVING ((([Waste Origin, Type, Destination, and Volume].
[TA ID])<>"53" And ([Waste Origin, Type, Destination, and
Volume].[TA ID])<>"1") AND (([Waste Origin, Type,
Destination, and Volume].MDA)="G") AND (([Waste Origin,
Type said:
ORDER BY [Waste Origin, Type, Destination, and Volume]. [Disposal Date];
.
 
Top