Select multiple tables when one table is empty in MySQL

前端 未结 5 1463
萌比男神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:20

    SELECT a.*, b.* FROM a LEFT JOIN b ON a.id = b.id 
    

    in this example id is just example name for join key

提交回复
热议问题