我需要计算某个字段的值出现了多少次,[i]like[/i]:
Name | Age | HowManyTimesTheNameRepeat
Ghaleon | 21 | 3
Ghaleon | 21 | 3
Ghaleon | 21 | 3
Bianca | 20 | 2
Bianca | 20 | 2
Carla | 25 | 1
编辑
我想我把事情弄糊涂了。这是我的代码:
SELECT t1.matricula AS Matricula, t1.descricao_debito AS Descricao, t1.quantidade AS Qtd,(SELECT COUNT(t2.name) FROM table1 AS t2 WHERE t1.name= t2.name) As MesmoNome
FROM table1 AS t1 INNER JOIN table2 AS t2 ON t1.dados_bancarios = t2.codigo
WHERE t1.dados_bancarios > 0 AND t1.configuracao = 2 AND t1.remessa = 116
GROUP BY t1.nome_titular
HAVING COUNT(*) > 0
这是我尝试过的,所以这是我真正需要的:
我需要知道同名重复了多少次,但我不能使用 group by,因为我需要接收每个结果行。此外,我的InnerJoin不会通过字段name发生。
可能吗?