Reputation: 5042
I have the following query:
SELECT
MachineName,
OperationId,
UserId,
RecordStamp,
Thread,
[Level],
Logger,
Message,
Exception
FROM
dbo.MainLog
GROUP BY
MachineName,
OperationId,
UserId,
RecordStamp,
Thread,
[Level],
Logger,
Message,
Exception
ORDER BY
RecordStamp DESC;
This is the output:
Now, the first group has only INFO
levels. I want to ignore this group. Next group has a WARN
and I need to include all of this group. How do I filter out groups with only INFO
type events? I tried to setup a HAVING clause but with in HAVING, I can still only filter rows and got group of rows. I do not want to filter everything with INFO
Level. I want to not include all groups having only INFO
events.
Upvotes: 0
Views: 452
Reputation: 100
Try This:
SELECT MachineName,OperationId, UserId, RecordStamp,Thread,[Level],Logger,
Message,Exception
FROM dbo.MainLog
WHERE OperationId IN (SELECT OperationId from dbo.MainLog WHERE LEVEL <> 'INFO'
GROUP BY OperationId)
Upvotes: 1