What am I missing? i think it's simple, but i can't grasp it.
From my SQL pasted below, I get a list of contractors that are listed before 10/1/2005, but not after 2005. This is exactly what I want, but I only want to return 1 value for each contractor (So if contractor XYZ has 5 rows before 10/1/2005, I only want to return 1 row). The 1 row returned also needs to be the most recent one.
I've tried changing the first line to 'Select Distinct Contractor', and this is the list I want, but it only returns the Contractor field and I need all fields.
Thanks in Advance!!
Here's my SQL:
Select *
From SalesTable A
Where EXISTS
(Select *
From SalesTable B
Where A.Contractor = B.Contractor
AND B.[Date] < #10/01/2005# )
AND NOT EXISTS
(Select *
From SalesTable C
Where C.Contractor = A.Contractor
AND C.[Date] > #10/01/2005# )
Order By Contractor
From my SQL pasted below, I get a list of contractors that are listed before 10/1/2005, but not after 2005. This is exactly what I want, but I only want to return 1 value for each contractor (So if contractor XYZ has 5 rows before 10/1/2005, I only want to return 1 row). The 1 row returned also needs to be the most recent one.
I've tried changing the first line to 'Select Distinct Contractor', and this is the list I want, but it only returns the Contractor field and I need all fields.
Thanks in Advance!!
Here's my SQL:
Select *
From SalesTable A
Where EXISTS
(Select *
From SalesTable B
Where A.Contractor = B.Contractor
AND B.[Date] < #10/01/2005# )
AND NOT EXISTS
(Select *
From SalesTable C
Where C.Contractor = A.Contractor
AND C.[Date] > #10/01/2005# )
Order By Contractor