Pl/Sql选择语句?

Bil*_*lıç 0 sql oracle plsql

有一个数据库表;

> == id || customer_number || account_type || balance
> == 1   - 123456          -  1              - 100
> == 2   - 123457          -  1              - 200
> == 3   - 123456          -  3              - 200
> == 4   - 123456          -  4              - 220
> == 5   - 123456          -  5              - 250
> == 6   - 123457          -  2              - 200
Run Code Online (Sandbox Code Playgroud)

如何选择至少具有{1和5}类型之一的客户?

soc*_*a23 7

如果您希望客户的帐户类型为1或5:

SELECT * FROM customers WHERE account_type IN (1, 5);
Run Code Online (Sandbox Code Playgroud)

[编辑]如果您希望客户的帐户类型为1和5:

SELECT DISTINCT(c1.customer_number)
FROM customers c1, customers c2
WHERE c1.customer_number = c2.customer_number
    AND c1.account_type = 1
    AND c2.account_type = 5
Run Code Online (Sandbox Code Playgroud)