显示除某些列之外的表中的所有列

时间:2013-02-16 17:58:19

标签: mysql sql

这是我的陈述:

SHOW FULL COLUMNS IN tbl_name WHERE NOT (
FIELD = 'col1' OR FIELD =  'col2'
)

我想将它减少到这样的程度,以便PHP代码更有效:

SHOW FULL COLUMNS IN tbl_name WHERE NOT (
FIELD = 'col1','col2'
)

1 个答案:

答案 0 :(得分:1)

select  COLUMN_NAME
from    INFORMATION_SCHEMA.COLUMNS
where   TABLE_NAME = 'tbl_name'
        and COLUMN_NAME not in ('col1', 'col2')