regex - how to create mysql view with REGEXP -
regex - how to create mysql view with REGEXP -
my table.value varchar. contains string '...totalvalue:xxxx,.... want create view extract xxxx from
value` , convert number column of view.
maybe this?
create view v_data select value regexp `.*,totalvalue:(.*),.*` (1).tonumber totalvalue table;
thanks much!!!
if can create select gives right reply can create view of select.
to extract parts of string utilize substr
. find out start , end positions utilize in substr utilize locate
':' , ','.
select substr(test, locate(':', test) + 1, locate(',', test) - locate(':', test) - 1) test;
sqlfiddle
mysql regex view
Comments
Post a Comment