mysql> select * from account;
+----------+---------+
| customer | balance |
+----------+---------+
| A        |      10 |
| B        |      10 |
| C        |      20 |
| D        |      30 |
| E        |      40 |
| F        |      50 |
+----------+---------+
6 rows in set (0.01 sec)

mysql> select A.customer, count(B.customer)
    -> from account A, account B
    -> where A.balance <=B.balance
    -> group by A.customer;
+----------+-------------------+
| customer | count(B.customer) |
+----------+-------------------+
| A        |                 6 |
| B        |                 6 |
| C        |                 4 |
| D        |                 3 |
| E        |                 2 |
| F        |                 1 |
+----------+-------------------+
6 rows in set (0.09 sec)

mysql> select A.customer, 1+count(B.customer)
    -> from account A, account B
    -> where A.balance < B.balance
    -> group by A.customer;
+----------+---------------------+
| customer | 1+count(B.customer) |
+----------+---------------------+
| A        |                   5 |
| B        |                   5 |
| C        |                   4 |
| D        |                   3 |
| E        |                   2 |
+----------+---------------------+
5 rows in set (0.03 sec)

mysql> update account set balance=10;
Query OK, 4 rows affected (0.08 sec)
Rows matched: 6  Changed: 4  Warnings: 0

mysql> select A.customer, count(B.customer)
    -> from account A, account B
    -> where A.balance <=B.balance 
    -> group by A.customer;
+----------+-------------------+
| customer | count(B.customer) |
+----------+-------------------+
| A        |                 6 |
| B        |                 6 |
| C        |                 6 |
| D        |                 6 |
| E        |                 6 |
| F        |                 6 |
+----------+-------------------+
6 rows in set (0.00 sec)

mysql> select A.customer, 1+count(B.customer)
    -> from account A, account B
    -> where A.balance < B.balance 
    -> group by A.customer;
Empty set (0.00 sec)