这是我的数据库项目。
表用户_
select id, name from user_;
 id |   name
----+----------
  1 | bartek
  2 | bartek_m
  3 | bartek_k
  4 | bartek_b
表顺序_
select id, employee_id, user_id from order_;
 id | employee_id | user_id
----+-------------+---------
  1 |           3 |       1
  2 |           4 |       1
  3 |           4 |       1
  4 |           4 |       1
  5 |           3 |       1
每个用户都有一个角色(我没有在这里添加表 role_ 但它存在)。每个具有员工角色的用户的 ID 可以分配给 order_.employee_id 我需要获得具有最少订单数的用户
select a.id, min(a.count) from (
    select u.id, count(u.id) from user_ u, order_ o
    where u.id = o.employee_id
    group by u.id
) as a group by a.id, a.count
 id | min
----+-----
  4 |   3
  3 |   2
我认为我的查询是错误的。任何人都可以更改查询以仅返回该用户具有最少订单数的 ID 吗?