I have a problem with a query: I have a table with a list of orders placed by customers
orders: customer_id, payment_method ...some other field
I need to extract the customer_id and a 'YES' if the customer has made at least one payment with a specific mode of payment
I tried something like this:
SELECT DISTINCT o.customer_id,
CASE WHEN o.payment_method = 10 THEN 'YES' ELSE 'NO' END AS credit_card
FROM orders AS o
WHERE o.year = 2012
ORDER BY o.customer_id
but in case the customer has made payments with different payment methods are shown two records, one with 'YES' one with a 'NO'... it's possible to get only one value?