I have a DETAILS table having
detail_id, customer_id and type
columns.
type can either be ‘A’ or ‘B’.
customer can have both type.
Goal is to find customer of Type B ONLY.
i.e output should not give customer details having both type.
detail_id | customer_id | type |
---|---|---|
0 | c1 | A |
1 | c2 | B |
2 | c1 | B |
3 | c3 | A |
The query should give only c2 as output.
Please let me know If I can achieve this without using 2 select statements.
3
Answers
Something along the following lines should do the trick:
Try the following query, which aggregates the type_id:
To complete my Anwser. Here is the Code for mysql: