MYSQL查询一个表中的所有字段
select CONCAT(COLUMN_NAME ,',') from information_schema.COLUMNS where table_name = '表名' and table_schema = '库名';
mysql> select CONCAT(COLUMN_NAME ,',') from information_schema.COLUMNS where table_name = 'ims_dg_article_payment' and table_schema = 'renren';
+--------------------------+
| CONCAT(COLUMN_NAME ,',') |
+--------------------------+
| id, |
| uniacid, |
| article_id, |
| openid, |
| oauth_openid, |
| transaction_id, |
| out_trade_no, |
| pay_money, |
| order_status, |
| pay_time, |
| fromer, |
| role_id, |
| v_id, |
| author_id, |
| v_day, |
| role_money, |
| serialize_id, |
| prepay_id, |
| pay_lose, |
+--------------------------+
19 rows in set
网友评论