It is not entirely easy to follow your question. Keep in mind that we don't know your table and business domain. It does not help that your query does not match the image you posted.
If I am to make a guess, this may be the query you are looking for:
; WITH numbering AS (
SELECT CreatedBy, Time, Type, rowno = row_number() OVER(ORDER BY Time)
FROM tbl
WHERE CreatedBy <> 'IT DESK'
AND Type = 'Log Comment'
)
SELECT CreatedBy, Time, Type
FROM numbering
WHERE rowno = 1
If this does not meet your needs, I recommend that you post CREATE TABLE statements for your table and INSERT statements with sample data, and the desired result given the sample. This has two benefits:
- It helps to clarify what you are looking for.
- It makes it easy to copy and paste into a query window to develop a tested solution.