If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Displaying One Record
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)); |
#2
|
|||
|
|||
Displaying One Record
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 .. "Chris" wrote in message ... 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)); |
Thread Tools | |
Display Modes | |
|
|