V
V
Valeria2020-05-21 17:27:38
SQL
Valeria, 2020-05-21 17:27:38

How to create an SQL query that displays the surnames, first names, patronymics of customers who received a loan above average?

SELECT Clients.Credit, Clients.Last Name, Clients.First Name, Clients.Patronymic
FROM Clients
GROUP BY Clients.Credit, Clients.Client_ID
HAVING (((Clients.Credit)>Avg([Clients]![Credit])));

I do this and it doesn't output anything.

in the table, the average loan is 12k, and so it varies from 1k to 2 million. only 10 people and you need to withdraw, in fact, only those people who took a loan from 12k and above

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2020-05-21
Lyulina @valeryalastor

Subquery (if the DBMS can do so)

SELECT ...
  FROM Клиенты
 WHERE Клиенты.Кредит > (
   SELECT Avg(Клиенты.Кредит) FROM Клиенты
 );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question