MySQL Select customers without an active order with JOIN -


so, trying select customers inactive mysql join. have following statement selects customers active service order.

select distinct u.* users u inner join orders o on o.assigned=u.id , o.status!=0 

this works fine. trying select customers had order order became deactivated (o.status equate value 0). have following statement (which close) returning customers still have active order, have order deactivated.

select distinct u.* users u inner join orders o on o.assigned=u.id , o.status!=1 

so in layman term, customer can have multiple service orders. every service being independent 1 another, want select customers deactivated. example:

susan has 2 service orders, 1 activated , other deactivated. right now, susan being populated in list of users deactivated , incorrect. customers orders deactivated.

thank you!

select u.*    users u    left   join orders o      on o.assigned=u.id     , o.status!=0  o.assigned null; 

or that


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -