为什么两个不同查询的结果在phpMyadmin中有不同的UI?

时间:2016-05-27 11:59:04

标签: phpmyadmin

我有两个具有相同输出的查询(但它们没有相同的顺序)。但是这两个查询的结果有不同的设计。以下是它们的两个截图:

查询1:

enter image description here

QUERY2:

enter image description here

如您所见,第二个查询为每一行都有一些工具(编辑,删除,复制)。为什么第一个查询没有?

编辑:以下是这两个查询:

查询1:

(SELECT id, event, seen, time_stamp 
 FROM notifications n
 WHERE id_user = 123 AND seen IS NULL
)UNION
(SELECT id, event, seen, time_stamp
 FROM notifications n
 WHERE id_user = 123 AND seen IS NOT NULL
 LIMIT 2
)UNION 
(SELECT id, event, seen, time_stamp 
 FROM notifications n
 WHERE id_user =  123
 ORDER BY (seen IS NULL) desc, time_stamp desc
 LIMIT 15
)
ORDER BY (seen IS NULL) desc, time_stamp desc;

QUERY2:

SELECT `id`, `event`, `seen`, `time_stamp`
FROM (SELECT `id`, `event`, `seen`, `time_stamp`, @`unread` := @`unread` + 1
      FROM `notifications`, (SELECT @`unread` := 0) `unr`
      WHERE `id_user` = 123 AND `seen` IS NULL
      UNION ALL
      SELECT `id`, `event`, `seen`, `time_stamp`, @`read` := @`read` + 1
      FROM `notifications`, (SELECT @`read` := 0) `r`
      WHERE `id_user` = 123 AND `seen` IS NOT NULL
            AND (
                 @`read` < (15 - @`unread`) OR
                 ((15 - @`unread`) < 0 AND @`read` < 2)
            )
) `source`

1 个答案:

答案 0 :(得分:2)

我认为如果系统检测到只有一个表,则允许您进行编辑。在你的第一个查询是一个三个表的连接(甚至是同一个表),但第二个查询直接从一个表获取数据(这是一个连接的结果,但最后是像一个表一样的mysql)

很奇怪,但似乎这样工作

:)

相关问题