mysql db user 表
int id,
field1 char,
field2 char,
field3 char,
......
假设我现在只知道这张表里有字段 id ,现在我想查询出表里内容为 null 的
字段所对应的字段名 fiels 和 id 号,
现在我只想到先查询表的所有字段,在循环查询得出结果这个办法,
有没有其他快捷的办法呢
mysql db user 表
int id,
field1 char,
field2 char,
field3 char,
......
假设我现在只知道这张表里有字段 id ,现在我想查询出表里内容为 null 的
字段所对应的字段名 fiels 和 id 号,
现在我只想到先查询表的所有字段,在循环查询得出结果这个办法,
有没有其他快捷的办法呢
|
id4alexNov 5, 2015
1
---现在我想查询出表里内容为 null 的
select * from user where id not in (select id from user where field1 is not null and field2 is not null .... and fieldn is not null) |
|
heaton_nobuNov 5, 2015
3
show columns from user
|
|
msg7086Nov 6, 2015
4
字段名也可以去 information_schema 找
|