Mysql
 sql >> Database >  >> RDS >> Mysql

Estrai l'URL da img src con una query mysql

Ecco un esempio funzionante per te:

CREATE TABLE test 
(
  id int auto_increment primary key, 
  details varchar(250)
);

INSERT INTO test (details) VALUES ('<img src="http://www.test.com/quiz_images/poster_from_postermywall.jpg" alt="" align="" border="0px">');

select substr(
   substr(details, locate('src="', details) + 5), 
   1, 
   locate('"', substr(details, locate('src="', details) + 5)) - 1
) as 'src'
from test;

SQL Fiddle:demo eseguibile