MySQL Forums
Forum List  »  Chinese

如何用ExtractValue把一列转成一个临时表
Posted by: sean sean
Date: June 09, 2014 08:58PM

我在一个列中保存数据,格式如下:
"
<row>
<code>000001</code>
<market>2</market>
<time>2014-05-01</time>
</row>
<row>
<code>399001</code>
<market>1</market>
<time>2014-05-02</time>
</row>
"
当用如下语句解析后,
select ExtractValue(STOCK_CODES,'row/code'), ExtractValue(STOCK_CODES,'row/market'),ExtractValue(STOCK_CODES,'row/time') from mytable;
返回结果是:
code market time
000001 399001 2 1 2014-05-01 2014-05-02

实际上,希望的结果是:
code market time
000001 2 2014-05-01
399001 1 2014-05-02
这个特性ORACLE是支持的。
如果用循环提取的话,数据量大的时候性能很差,不知道MYSQL现在有没有什么好的做法呢?

Options: ReplyQuote


Subject
Views
Written By
Posted
如何用ExtractValue把一列转成一个临时表
6740
June 09, 2014 08:58PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.