Seth Pritchard Seth Pritchard - 1 year ago 46
SQL Question

Im trying to return a string based on a value from a list

So I have a list of ID's that later put a string to describe the issue.

I want to filter these out by their id and display a string based on the primary id#

sol.solution `Solution`,
count( `Solution Count`,
case when 8,9,10,11,12,13,14,15,16,25,29,33,37,40,41,42,48,51 then 'Hardware'
else 'Software' end `HW/SW`
from tickets t
join ticket_solutions tsol
on tsol.ticket_id
join solutions sol
on tsol.solution_id =

Answer Source

Since your description is not 100% clear here is just my guess:

sol.solution `Solution`,
COUNT( `Solution Count`,
IF( IN (8,9,10,11,12,13,14,15,16,25,29,33,37,40,41,42,48,51),'Hardware','Software') `HW_SW`
FROM tickets t
JOIN ticket_solutions tsol
  ON tsol.ticket_id
JOIN solutions sol
  ON tsol.solution_id =