📜  如何从每个客户端 sql 代码示例中的表中选择最小值

📅  最后修改于: 2022-03-11 15:05:27.210000             🧑  作者: Mango

代码示例2
SELECT DISTINCT
                        t1.CompliancyID ,t1.[Status],t1.FK_ClientID
                    FROM #VettingCompliance  t1
                    INNER JOIN 
                    (
                    SELECT FK_ClientID, min(CompliancyID) AS CompliancyID FROM #VettingCompliance GROUP BY FK_ClientID
                    ) t2 ON t2.CompliancyID = t1.CompliancyID AND t1.FK_ClientID = t2.FK_ClientID