mysql query to select all except something

前端 未结 2 1810
暖寄归人
暖寄归人 2021-01-25 04:56

i\'m trying to select the customers who purchase only vegetables in food table.But i can\'t use except in query.How can i do this?

    create table Order (
            


        
2条回答
  •  长情又很酷
    2021-01-25 05:23

    select ro.email
    from registerorder ro 
    inner join food f on f.namea = ro.namea
    group by ro.email
    having sum(f.type <> 'vegtables') = 0
    

提交回复
热议问题