Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法在一个表中显示来自两个未连接表的数据?
两张桌子
他们之间的关系
您可以使用UNION查询并获取所有数据而无需任何关联
UNION
SELECT * FROM TABLE A UNION SELECT * FROM TABLE B
或者您可以使用INNER JOIN查询并将三个表与相关数据一起使用,但这会导致您的查询速度变慢
INNER JOIN
SELECT a.*, c.* FROM TABLE A LEFT JOIN TABLE B ON a.id = b.id LEFT JOIN TABLE C ON b.id = b.id