Requête substring_index help
Bonjour,
Je post ici car j'arrive au bout de mes maigres compétences en SQL et cherche donc une réponse auprès de grands maîtres ... :mrgreen:
Voila je fais un select:
Code:
1 2 3 4 5
|
SELECT h.PROCESSORN, h.MEMORY, h.LASTCOME, h.OSNAME,n.IPADDRESS as ip ,h.name
FROM web.networks n, web.hardware h
where n.HARDWARE_ID = h.ID and n.IPADDRESS like '172.22.56%'
order by inet_aton(ip) asc; |
dans une base. Tout est nickel sauf que certaines valeurs pour le IPADDRESS me sont renvoyés ainsi dans une case séparée par des virgules:
Citation:
8, 32768, '2012-02-03 13:49:52', 'Microsoft Windows Server 2003 R2 Enterprise x64 Edition', '172.22.56.110,172.22.56.12,172.22.56.123,172.22.56.122,172.22.56.11,172.22.56.40', 'machine_hostname'
Je souhaiterai donc pouvoir modifier ma requête pour avoir une adresse IP par ligne ainsi:
Citation:
8, 32768, '2012-02-03 13:49:52', 'Microsoft Windows Server 2003 R2 Enterprise x64 Edition', '172.22.56.110, 'machine_hostname'
8, 32768, '2012-02-03 13:49:52', 'Microsoft Windows Server 2003 R2 Enterprise x64 Edition', '172.22.56.12, 'machine_hostname'
....
. J'ai vu que la fonction substring_index() pour découper en utilisant la "," comme séparateur mais je ne parvient à rien :(. Si quelqu'un peut donc me filer un coup de main ce serait top sinon bonn route quand même !
Cdlt,