Home Forums SQL Server 2008 T-SQL (SS2K8) Using Results from one column to calculate another column RE: Using Results from one column to calculate another column

  • CELKO (1/4/2013)

    Think about what a confused mess this statement is in the SQL model.

    SELECT f(c2) AS c1, f(c1) AS c2 FROM Foobar;

    That is why such nonsense is illegal syntax.

    Your claim is nonsense. I don't see what's illegal about that general syntax in SQL Server, viz:

    SELECT RTRIM(c2) AS c1, RTRIM(c1) AS c2

    FROM (

    SELECT 'Y' AS c1, 'Z' AS c2 UNION ALL

    SELECT 'C' AS c1, 'D' AS c2 UNION ALL

    SELECT 'A' AS c1, 'B' AS c2

    ) AS test_data

    ORDER BY c1

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".