Crosstab to SQL

  • Could someone convert this Access crosstab to sql 2000 for me.

    TRANSFORM Count(Quickvote.ID) AS CountOfID

    SELECT Quickvote.Comb, Count(Quickvote.ID) AS [Total Of ID]

    FROM Quickvote

    GROUP BY Quickvote.Comb

    PIVOT Quickvote.Location;

  • The only way to do this is self join or use code from a front end tool.

    select comb, cnta, cntb, cntc

    from ( select comb, count(*) 'cnta'

    from quickvote a

    where locaiton = 'z'

    ) a

    inner join ( select comb, count(*) 'cnta'

    from quickvote a

    where locaiton = 'y'

    ) b

    on a.comb = b.comb

    ...

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply