我正在尝试在mysql 5.7上执行以下查询:
SELECT
example.id AS id,
COUNT((
SELECT DISTINCT example1.id
FROM example1
WHERE example1.id = example.id
)) AS counter
FROM example;
我收到错误:subquery returns more than 1 row
实现我想要的计数的正确方法是什么?我需要分别为每行存在的count of example1
行 example
行