MySQL选择列数最多的表?
发布时间:2020-12-11 23:46:28 所属栏目:MySql教程 来源:网络整理
导读:select t.table_name from information_schema.tables tleft join information_schema.columns con c.table_name = t.table_nameand c.table_schema = t.table_schemawhere t.table_schema = 'test'and count(c.column_name) = max(count(c.column_name)) 我
我试图从数据库“test”中选择具有最高列数的表.但是,我无法做到这一点.我也尝试选择count(c.column_name),但不是返回每个表的列数,而是返回最大列数. 如何选择列数最多的表? 最佳答案 尝试按表名分组.就像是:
Fiddle (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |