1.場合
select...caseが複雑の時
2.運用方法
1 SELECT * 2 FROM stu 3 CROSS APPLY ( --like inner join 4 SELECT TOP 1 * FROM score WHERE stu.stuId=score.stuId ORDER BY score DESC 5 ) AS ff 6 /* 7 OUTER APPLY ( --like left join 8 SELECT TOP 1 * FROM score WHERE stu.stuId=score.stuId ORDER BY score DESC 9 ) AS ff 10 */
虽然apply性能低,但是也有其用武之地,当需要按照顺序进行连接时,apply是最好的选择。