SQL statement to get all customers with no orders

前端 未结 3 1538
甜味超标
甜味超标 2021-02-07 06:14

I have a typical Persons table and an Orders table defined in such a way that I can do JOIN query as the following to return Orders for all Persons.

SELECT Perso         


        
3条回答
  •  盖世英雄少女心
    2021-02-07 07:01

    This should work... theres more than one way to do it.

    select * from persons where person.id not in (select person_id from orders)
    

提交回复
热议问题