我正在存储这样的日志:
10.03.2015 11:45:29-JAQ -- Updated Following Information
Mobile Updated From 0 to 0502770020</br>
Company Industry Id Updated From 747 to 753</br>
Name Updated from futurehomes to futurehomesdubai </br>
Company Head Office Updated From 0 to 1</br>
Company Telephone Updated From 8008436699 to
Company Comments Updated From Offices and Hotel (Under Construction) to Offices and Hotel (Under Construction) info@futurehomesdubai.com futurehomesdubai.com</br>
Company Toll Free No Updated From to 800-8436699</br>
Company(139618) Industry Sub Section Updated </br>
我将其存储在文本字段中。由此我只需要显示 名称从futurehomes更新到futurehomesdubai部分。未来家园的未来之家将根据公司名称而改变。我怎么能这样做?
答案 0 :(得分:0)
以下例如:
create table logs(tlog text);
insert into logs values ('Mobile Updated From 0 to 0502770020</br>Company Industry Id Updated From 747 to 753</br>Name Updated from futurehomes to futurehomesdubai </br>Company Head Office Updated From 0 to 1</br>Company Telephone Updated From 8008436699 to
Company Comments Updated From Offices and Hotel (Under Construction) to Offices and Hotel (Under Construction)info@futurehomesdubai.com futurehomesdubai.com</br>Company Toll Free No Updated From to 800-8436699</br>Company(139618) Industry Sub Section Updated </br>');
并且选择应该是
select *
from (
select unnest(regexp_split_to_array(tlog,'</br>')) col
from logs
)t
where col ilike 'Name Updated%'
结果:
col
--------------------------------------------------
Name Updated from futurehomes to futurehomesdubai