开发者

read element of serialize field in mysql

i ran this query on mysql:

select rc_details from apitbl limit 1;

the result is

a:7:{s:6:"itemid";s:9:"PCO FLEXI";s:2:"op";s:1:"P";s:3:"cir";s:1:"*";s:3:"api";s:1:"3";s:3:"loc";s:1:"P";s:4:"type";s:1:"F";s:4:"mode";s:1:"T";}

My Problem:

i want to extract elements from the serialize fields to run query as:

select rc_开发者_高级运维details from apitbl where (itemid='PCO FLEXI');


Something like this might do it:

SELECT rc_details FROM apitbl WHERE rc_details REGEXP '.*"itemid";s:[0-9]+:"PCO FLEXI".*'

Anyway it's much better to create additional table and store this info there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜