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

SQL-Gruppierung - Nur 5 Kommentare pro Post anzeigen

select
   *
FROM
   tblPost P
   OUTER APPLY
   (SELECT TOP 5 * FROM tblComment C  
      WHERE P.id = C.postid
      ORDER BY something) inline