Sqlserver
 sql >> Datenbank >  >> RDS >> Sqlserver

Sql-Abfragenummer des Vorkommens

Das sollte es tun:

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