SELECT TO REDUCE VARIOUS INPUTS SEEN IN MYSQL

0

Good morning, I have searched and found nothing very useful. I have an inventory database of my Network Stations. The agent installed on each station sends the names of installed programs to the softwares.name table. When I make a select , there are several similar entries, like:

  
  • Microsoft Visual C ++ 2013 Redistributable (x86) - 12.0.40660,
  •   
  • Microsoft Visual C ++ 2013 x64 Additional Runtime - 12.0.40660,
  •   
  • Microsoft Visual C ++ 2013 x64 Minimum Runtime - 12.0.40660,
  •   
  • Microsoft Visual C ++ 2013 x86 Additional Runtime - 12.0.40660,
  •   
  • Microsoft Visual C ++ 2013 x86 Minimum Runtime - 12.0.40660;
  •   

When the ideal would be to have only one output

  

"Microsoft Visual C ++ 2013"

Can you do this?
Follow my select :

SELECT s.NAME 
FROM hardware as h, softwares as s 
WHERE h.ID = s.HARDWARE_ID
ORDER BY s.NAME
    
asked by anonymous 14.11.2018 / 14:33

1 answer

0

You can use substring with subselect to do this:

SELECT DISTINCT X.NAME FROM
(
SELECT h.HOST, substring(s.NAME,1, 25) AS NAME
FROM hardware as h, 
softwares as s 
WHERE h.ID = s.HARDWARE_ID AND ORDER BY s.NAME
) as x
    
14.11.2018 / 14:50