Selecting single Record From multiple similar results

diggydog

New Member
\[code\]SELECT TOP (100) PERCENT dbo.vwLatestEquipment.equipServID, dbo.tblEquipInvoice.invoiceDateSent, dbo.tblEquipment.equipManafacturer, dbo.tblEquipInvoice.contractNumber, dbo.tblEquipment.equipmentID, dbo.tblEquipment.equipStatus, dbo.tbl_work_locations.work_location, dbo.vwLatestEquipment.calibDueDateFROM dbo.vwLatestEquipment INNER JOIN dbo.tblEquipLocations ON dbo.vwLatestEquipment.locationID = dbo.tblEquipLocations.locationID INNER JOIN dbo.tblEquipInvoice ON dbo.tblEquipLocations.invoiceID = dbo.tblEquipInvoice.invoiceID INNER JOIN dbo.tblEquipment ON dbo.vwLatestEquipment.equipServID = dbo.tblEquipment.equipServID INNER JOIN dbo.tbl_work_locations ON dbo.tblEquipInvoice.workLocationID = dbo.tbl_work_locations.work_idGROUP BY dbo.tbl_work_locations.work_location, dbo.vwLatestEquipment.equipServID, dbo.tblEquipInvoice.invoiceDateSent, dbo.tblEquipment.equipManafacturer, dbo.tblEquipInvoice.contractNumber, dbo.tblEquipment.equipmentID, dbo.tblEquipment.equipStatus, dbo.tbl_work_locations.work_location, dbo.vwLatestEquipment.calibDueDateORDER BY dbo.vwLatestEquipment.equipServID\[/code\]This is one that's been passed to me from my successor, the view above is working fine for purpose, except it returns all the values for calibDateDue for every item of equipmentID All I want is for it to return the most recent calibDueDate for each item of equipment (equipmentID) any help would be appreciated today as I am fried and cant make much headway.
 
Back
Top