我想做一个 MySQL 查询。我有 4 张桌子:A、B、C、D。
我想从所有 4 个表中获得共同值:“wins”,其中“account”=1,然后按大多数“wins”排序。并且所有订购的“获胜” LIMIT 为 3 。
如果你帮助我,我会很高兴。
我试过这样的事情:
SELECT o.*
FROM (
(SELECT wins FROM 'A')
UNION ALL
(SELECT wins FROM 'B')
UNION ALL
(SELECT wins FROM 'C')
UNION ALL
(SELECT wins FROM 'D')
UNION ALL
(SELECT * FROM 'A'
WHERE
account=1)
) AS o
ORDER BY wins DESC
但这确实是错误的。