【问题标题】:Why is the phpmyadmin search saying there is not unique column?为什么 phpmyadmin 搜索说没有唯一列?
【发布时间】:2020-05-10 03:53:54
【问题描述】:

我正在使用以下 SQL 代码搜索我的 MySQL 数据库:

SELECT a.* FROM clients a JOIN (SELECT email, COUNT(*) FROM clients GROUP BY email HAVING count(*) > 1 ) b ON a.email = b.email ORDER BY a.email

。但是,经过我的搜索,出现的行显示:Current selection does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available.

然而,标记为主键的列 clientID 仍然存在,但我仍然无法编辑。有什么问题?

这是我的 clientID 结构。

这是搜索返回的内容。同样在任何人提到它之前,密码都是经过哈希处理的。

谢谢!

【问题讨论】:

  • 我怀疑加入是你的问题。
  • 我相信它指的是唯一索引,它在一行或多行中缺失(由于您的加入)。看到这个问题:PHPMyAdmin 4.0.5 - Grid edit, checkbox, Edit, Copy and Delete features are not available
  • @EternalHour 但 clientID 列已设置为主索引。哪个是独一无二的?
  • @TimRumit 是的,但它不是(或可能不是)在查询结果的上下文中是唯一的(因为连接,正如 EternalHour 提到的)

标签: mysql sql database phpmyadmin


【解决方案1】:

我将 SQL 查询更改为以下内容:

select * from clients a where ( email ) in ( select email from clients group by email having count(*) > 1 )

现在它可以用于编辑和删除等。

【讨论】:

    猜你喜欢
    • 2014-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-17
    • 1970-01-01
    • 1970-01-01
    • 2016-11-18
    • 1970-01-01
    相关资源
    最近更新 更多