Here is what I am looking to achieve:
I would like to have the individual, specific, line entries for each entry in ServiceDocument. This should be 31 total entries. (10 entries from Timeslip and 21 entries from ServiceDocumentDetail)
What I am receiving are duplicated entries for each line item, 231 lines are a result of my query, see below...
How do I properly write this statement?
Here is what the data contains:
ServiceDocument is the original Document
ServiceDocumentDetail has the individual line details of ServiceDocument
Timeslip is every entry that is associated with the Service Document
TimeslipEntryTask has a reference to each of the Timeslip entries
Here is my current query:
SELECT
ServiceDocument.ServiceDocument_ID, ServiceDocumentDetail.ServiceDocument_ID AS SERVICEDOC_ID,
TimeSlip.TaskID, TimeEntryTask.ID AS TIME_ID,
ServiceDocument.Document_ID, TimeSlip.RepairOrderDocumentID
FROM TimeSlip INNER JOIN
TimeEntryTask ON TimeSlip.TaskID = TimeEntryTask.ID INNER JOIN
ServiceDocument ON ServiceDocument.Document_ID = TimeSlip.RepairOrderDocumentID INNER JOIN
ServiceDocumentDetail ON ServiceDocument.ServiceDocument_ID = ServiceDocumentDetail.ServiceDocument_ID
WHERE (TimeSlip.RepairOrderDocumentNumber = '33082')