I have the following two tables
customers
| customer_id | firstname | lastname | email |
|-------------|-----------|----------|----------------------|
| 1001 | John | Doe | [email protected] |
| 1002 | Lorem | Ipsum | [email protected] |
| 1003 | Alph | Beta | [email protected] |
And orders
| order_id | customer_id | via | status |
|----------|-------------|-----|------------|
| 100 | 1001 | WEB | pending |
| 101 | 1001 | | pending |
| 102 | 1001 | POS | pending |
| 103 | 1002 | WEB | processing |
| 104 | 1002 | APP | pending |
| 105 | 1001 | APP | completed |
| 106 | 1003 | | pending |
I want to get the following resultset:
- All the customers who have ordered via
WEB
or (EMPTY) but not fromPOS
- All the customers who have ordered only via
APP