我在多个表中有一些数据,我想连接这些表,并且需要将结果显示为下面的表结构中的多个记录
main_table
id name height
1 test1 5.2
2 test2 4.6
child_table
id main_table_id name height
1 1 test3 5.3
2 1 test4 4.5
期望结果如
id name height
1 test1 5.2
1 test3 5.3
1 test4 4.5
如何在mysql中使用查询来实现这一点?
2条答案
按热度按时间pn9klfpd1#
尝试使用left和colasce
qyswt5oh2#
使用并集