Query to get Solution of particular topic and its first level child topic list and with status filter.

Query to get Solution of particular topic and its first level child topic list and with status filter.

Version : 10524
DB : MSSQL

OUTPUT :




SELECT solution.solutionid "Solutionid" ,
kb1.TOPICNAME " Topic",
case when kb2.topicname is null then kb1.TOPICNAME else
kb2.topicname end "Parent",
Solution.TITLE "Subject ",
Sol_StatusDefinition.STATUSNAME "Status" FROM Solution
INNER JOIN SolutionInfo ON Solution.SOLUTIONID=SolutionInfo.SOLUTIONID
LEFT JOIN KB_Topics kb1 ON Solution.TOPICID=KB1.TOPICID
left join topichierarchy tc on KB1.TOPICID=tc.TOPICID
LEFT JOIN KB_Topics kb2 ON tc.parentid=KB2.TOPICID
LEFT JOIN AaaUser Updater ON SolutionInfo.LASTUPDATEDBY=Updater.USER_ID
LEFT JOIN AaaUser Creator ON SolutionInfo.CREATEDBY=Creator.USER_ID
LEFT JOIN Solution_Keywords ON Solution.SOLUTIONID=Solution_Keywords.SOLUTIONID
LEFT JOIN Sol_StatusDefinition ON Solution.STATUSID=Sol_StatusDefinition.STATUSID where Sol_StatusDefinition.STATUSNAME = 'UnApproved' and (kb1.TOPICNAME = 'ServiceDesk Plus' or kb2.TOPICNAME = 'ServiceDesk Plus')

Note : Kindly change the status and Topic name in both places Kb1 and Kb2 as per the requirement.

                  New to ADSelfService Plus?