Thanks for the reply. I had to add some parenthesis in to get rid of an error.
Code:
SELECT I.Incident
, IN2.Description
, IN2.Summary
, IN2.IncidentNoteID
FROM (Incidents as I
INNER
JOIN IncidentNotes as IN1
ON I.Incident = IN1.Incident)
INNER
JOIN IncidentNotes as IN2
ON I.Incident = IN2.Incident
WHERE (
IN1.Description Like '*'&search&'*'
OR IN1.Summary Like '*'&search&'*'
)
and IN2.IncidentNoteID
= ( select max(IncidentNoteID)
from IncidentNotes
where Incident = I.Incident )
It's returning exactly what I want it to now, except it's still listing duplicates. It's not because I added the parenthesis wrong is it?
Before:
Code:
incident description summary incidentnoteid
-------- ------------- ------- --------------
3 bought pencil need pencil 12
3 sent pencil need pencil 13
3 got pencil need pencil 14
Now:
Code:
incident description summary incidentnoteid
-------- ----------- ----------- --------------
3 got pencil need pencil 14
3 got pencil need pencil 14
3 got pencil need pencil 14
Is this easily remedied?
Bookmarks