Select multiple tables when one table is empty in MySQL

前端 未结 5 1452
萌比男神i
萌比男神i 2020-12-10 06:37

I\'m trying to do

SELECT * FROM a, b

However, it doesn\'t return anything if one of the tables is empty. How do I make it so it returns \'a

5条回答
  •  执念已碎
    2020-12-10 07:14

    SELECT * FROM a LEFT JOIN b ON a.ID = b.ID
    

    Will return everything from a even if b is empty.

提交回复
热议问题