I have 2 tables:
manifests
id | customer | paid_order | price | payment_method
paid_orders
id | paid
JOIN paid_orders ON manifests.paid_order = paid_order_id
Let's assume this scenario:
There are 2 samecustomer
but has differentpayment_method
.
customer | paid_order | price | payment_method | paid |
1 | 1 | 200 | 0 | 200 |
1 | NULL | 100 | 1 | NULL |
2 | NULL | 150 | 1 | NULL |
I only want to GROUP BY customer
but also PICK only the payment_method
of 0
only if there are two same customer.
Expected result:
customer | paid_order | price | payment_method | paid |
1 | 1 | 200 | 0 | 200 |
2 | NULL | 150 | 1 | NULL |