MIGxxx Posted November 25, 2013 Report post Posted November 25, 2013 Hello, i use the following query to get a license report but i´m not quite happy with the result and don´t know how to edit it. declare @ChannelCode varchar(32)select @ChannelCode = 'All'declare @ProductName nvarchar(255)select ProductName,FamilyName,VersionCode, coll.Name,MAX(VersionSequence) as VersionSequence,MAX(ChannelCode) as ChannelCode,count(distinct ilp.ResourceID) as InventoryCountfromdbo.vInventoriedLicensedProduct ilpleft join v_FullCollectionMembership fcm on ilp.ResourceID = fcm.ResourceIDleft join v_Collection coll on fcm.CollectionID = coll.CollectionIDwhere(ilp.ProductName = @ProductName OR @ProductName IS NULL)and(@ChannelCode is NULL or @ChannelCode = N'All' OR ilp.ChannelCode = @ChannelCode)group by ProductName, FamilyName, VersionCode, coll.Name The result is the following: The problem with the result is that every collection is listed in the column Name. But i only want to choose some of them. How can i edit the query to get a result with only three collections ? The best result would be the following, but for this i think i have to modify the whole query. Any experts who can help me ? Quote Share this post Link to post Share on other sites More sharing options...