如果您只想要“失败的用户详细信息”,那么根本不要选择ntext
orimage
列。这样你就可以正常地做一个 DISTINCT :
SELECT DISTINCT
--Parameters,
--Content,
--Property,
--Parameter,
InstanceName, ReportID, UserName, RequestType, Format, TimeStart, TimeEnd,
TimeDataRetrieval, TimeProcessing, TimeRendering, Source, Status, ByteCount,
[RowCount], ItemID, Path, Name, ParentID, Type, Intermediate, SnapshotDataID,
LinkSourceID, Description, Hidden, CreatedByID, CreationDate, ModifiedByID,
ModifiedDate, MimeType, SnapshotLimit, PolicyID, PolicyRoot, ExecutionFlag,
ExecutionTime
FROM executionlog e
JOIN catalog c ON e.reportid = c.itemid
WHERE c.name LIKE '%reportname%'
AND timestart>= '2013-04-15 09:00:00.000'
AND status <> 'rsSuccess'
您甚至可以修剪更多列。请注意,无论如何,在许多情况下这样做SELECT *
是一种不好的做法。
如果您对相应的ntext
和/或image
值感兴趣,您可以随时catalog
再次加入反对上述子查询。