MySQL : XML from a resultset?
Is it possible to generate an XML (or csv) string from a resultset in MySQL ?
Basically I'd like to hav开发者_运维技巧e the contents of an entire record in 1 string...
Yes, here is the documentation for XML, and a reference to the CSV question on SO.
Just a quick example, you can use xml_tag
like this:
select xml_tag('table',table_name,null,null)
from information_schema.tables
where table_schema = 'INFORMATION_SCHEMA'
Comprehensive Docs:
- http://dev.mysql.com/tech-resources/articles/xml-in-mysql5.1-6.0.html
精彩评论