Home > Database > Mysql Tutorial > body text

如何取得一个表的所有字段名用逗号分割_MySQL

WBOY
Release: 2016-06-01 14:05:08
Original
1463 people have browsed it

自从 Oracle 9i 开始,就可以通过SYS_CONNECT_BY_PATH 函数实现将从父节点到当前
行内容以“path”或者层次元素列表的形式显示出来。

取得一个表的所有字段名,用逗号分割。

select max(substr(SYS_CONNECT_BY_PATH(COLUMN_NAME, ','),2)) col from (
select COLUMN_NAME,column_id from user_tab_columns where table_name='&表名')
start with column_id=1
connect by column_id=rownum;

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