Displaying One Record

C

Chris

I have the following SQL code in a report. In the Tbl_Inspection_Phases
table, a [Prop Code] may be listed multiple times with either the same or
different [Due Date]. If a [Prop Code] has [Due Date] that are the same, I
would like only one of the [Prop Code] to print on the report. If the [Due
Date] are differnt for the same [Prop Code], then both [Prop Code] should
print. Thanks

SELECT Tbl_Hotels.[Project Manager], Tbl_Inspect.Status, Tbl_Hotels.[PM on
Hold], Tbl_Hotels.[Prop Code], Tbl_Hotels.[Property Name],
Tbl_Inspection_Phases.Type, Tbl_Inspection_Phases.[Due Date],
Tbl_Inspection_Phases.Phase, Tbl_Inspection_Phases.[Inpsection Date],
Tbl_Inspection_Phases.Variance
FROM (Tbl_Hotels INNER JOIN Tbl_Inspect ON Tbl_Hotels.ID =
Tbl_Inspect.[Hotel ID]) INNER JOIN Tbl_Inspection_Phases ON
Tbl_Inspect.InspectionID = Tbl_Inspection_Phases.[Inspection ID]
WHERE (((Tbl_Inspect.Status)="Reno") AND ((Tbl_Hotels.[PM on Hold])=False));
 
J

John Spencer

Try adding the keyword DISTINCT to your query.

SELECT DISTINCT Tbl_Hotels.[Project Manager]
, Tbl_Inspect.Status
, Tbl_Hotels.[PM on Hold]
, Tbl_Hotels.[Prop Code]
, Tbl_Hotels.[Property Name] ...

IF that does not give you the desired result then post back with an example
of what you are getting now and what you want to see.
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

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

Top