SQLTeam.com | Weblogs | Forums

T-SQL query to achieve multiple filtering


#1

Hello All,
I am trying to develop an SSRS report with SCCM as a data source while doing that I Need to use multi select parameter value having a values some thing like ( %Acrobat 4%,%Acrobat 5%,%Acrobat 8%Pro%,%Acrobat 9%Pro%,%Creative Cloud% etc )

When I look at this a s filter criteria to SQL query I am not able to return any result set.

Query formed when I look at the profiler trace:

SELECT v_R_System.Netbios_Name0 AS [Computer Name], v_GS_ADD_REMOVE_PROGRAMS.DisplayName0 AS [Software Title], v_GS_ADD_REMOVE_PROGRAMS.Version0 AS Version
FROM v_R_System INNER JOIN
v_GS_ADD_REMOVE_PROGRAMS ON v_R_System.ResourceID = v_GS_ADD_REMOVE_PROGRAMS.ResourceID INNER JOIN
v_FullCollectionMembership ON v_GS_ADD_REMOVE_PROGRAMS.ResourceID = v_FullCollectionMembership.ResourceID
WHERE (v_GS_ADD_REMOVE_PROGRAMS.DisplayName0 LIKE @software) AND v_FullCollectionMembership.CollectionID = @region

UNION

SELECT v_R_System_1.Netbios_Name0 AS [Computer Name], v_GS_ADD_REMOVE_PROGRAMS_64.DisplayName0 AS [Software Title], v_GS_ADD_REMOVE_PROGRAMS_64.Version0 AS Version
FROM v_R_System AS v_R_System_1 INNER JOIN
v_GS_ADD_REMOVE_PROGRAMS_64 ON v_R_System_1.ResourceID = v_GS_ADD_REMOVE_PROGRAMS_64.ResourceID INNER JOIN
v_FullCollectionMembership ON v_GS_ADD_REMOVE_PROGRAMS_64.ResourceID = v_FullCollectionMembership.ResourceID
WHERE (v_GS_ADD_REMOVE_PROGRAMS_64.DisplayName0 LIKE @software) AND v_FullCollectionMembership.CollectionID = @region

How can I rewrite this query to use this as a filter to return the data set.
Please
help