Home > Database > Mysql Tutorial > body text

在SQL中生成XML文本

WBOY
Release: 2016-06-07 16:19:27
Original
1047 people have browsed it

在SQL中自定义XML的根节点和子节点 select * from table FOR XML PATH('child'),ROOT('parent') 多表查询一个主表一个子表的话 select *, (select * from subTable where subTable.id=master.id FOR XML PATH('child'),ROOT('parent'),TYPE ) from master FO

 在SQL中自定义XML的根节点和子节点

select * from table FOR XML PATH('child'),ROOT('parent')

多表查询一个主表一个子表的话

select *,

(select * from subTable where subTable.id=master.id

FOR XML PATH('child'),ROOT('parent'),TYPE

)

from master

FOR XML PATH('child'),ROOT('parent')

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!