MySQL:当前选择不包含唯一列.网格编辑、复选框、编辑、复制和删除功能不可用

2022-01-05 00:00:00 mysql phpmyadmin unique-key

我已阅读有关 SO 中有关我的问题的所有帖子.但没有什么能解决这个问题.

I have read all the posts regarding my issue in SO. But nothing fixed this.

问题:运行上述查询时,会出现以下警告.

Issue: When runs the mentioned query, below warning appears.

当前选择不包含唯一列.网格编辑、复选框、编辑、复制和删除功能不可用.

以下是我的查询.

SELECT ST.stock_code, S.supplier_name, I.item_name, P.avail_qty, SL.unit_price, P.expire_date 
FROM purchase_items P 
INNER JOIN stock ST ON P.stock_id = ST.stock_id 
INNER JOIN suppliers S ON ST.sup_id = S.sup_id 
INNER JOIN items I ON P.item_id = I.item_id 
INNER JOIN sales SL ON P.item_id = SL.item_id 
WHERE (P.expire_date > (NOW() + INTERVAL 1 MONTH))

purchase_items 表

推荐答案

我在使用 VIEW 时遇到了同样的问题,看起来 phpmyadmin 无法证明结果查询中存在表设计所独有的列.在您的情况下,它是stock_id,但由于有多个表连接并且其他行中不存在stock_id,因此无法确定编辑或删除时应影响哪一行.可以通过配置禁用此警告

I faced same problem when I use VIEW and looks like it's phpmyadmin just can't prove that there are columns in resulting query that unique by table design. In your case it's stock_id, but since there is multiple table join and stock_id is not present in other rows it is unable to deside what row shoild be affected on edit or delete. This warning could be disabled via config

$cfg['RowActionLinksWithoutUnique'] = true

https://docs.phpmyadmin.net/en/latest/config.html#cfg_RowActionLinksWithoutUnique

解决方案:这个表不包含唯一列.网格编辑、复选框、编辑、复制和删除功能不可用

相关文章