Sqlserver
 sql >> Base de Dados >  >> RDS >> Sqlserver

Número de ocorrência da consulta SQL


Isso deve servir:
SELECT c.*
FROM cars c
    JOIN
    (
        SELECT carCode 
        FROM articles
        WHERE Accepted = 1
        GROUP BY carCode
        HAVING COUNT(carCode) > 1
    ) a ON c.code = a.carCode