SELECT o.id, c.name, o.amount FROM test.e_order o, test.e_customer c WHERE o.e_customer_id = c.id OR o.e_customer_id IS NULL ORDER BY o.id ASC;
Expected result:
--------------------- | id | name | amount | --------------------- | 1 | John | 1000 | --------------------- | 2 | | 2000 | ---------------------
If you want that result try revising your query. select e.id, c.name, e.amount from test.e_order as e left join test.e_customer as c on c.id=e.e_customer_id;