• SQLRNNR (4/28/2015)


    Hey, so far it is improved in % correct. Only 53% got it correct when I asked a very similar question a few years back.

    http://www.sqlservercentral.com/questions/Subquery/75557/

    I wonder how many people took one look at that, said to themselves "if anyone writes queirs like they should be trained not to because it's a jumbled mess", decided they couldn't be bothered to parse it by hand, and picked an answer at random to see what came out.

    As Paul said at the time, "The question could have made the same point, with the same learning value, much more simply".

    To could be added "and without mixing CTE and subquery together in a join when there's no conceivable reason not to do either both as CTEs or both as subquries, resulting in rather ugly SQL".

    Tom