HELP FOR ADVANCED QUERY

  • Hello!

    I have this problem

    i need to transform a union query

    (SELECT     a, b, SUM(1) AS c

     FROM         TABLE

     WHERE     (b= 14) AND (CRITERIO1) GROUP BY a, b)

    UNION

    (SELECT     a, b, SUM(1) AS c                                                  FROM TABLE

     WHERE     (b IN (5)) AND (CRITERIO1) GROUP BY a, b)

    in a single select that return a,(how many b=14 where criterio1),(how many b=5 where criterio1)

    grouping by a,b

    Thanks!!

  • Please post this in the T-SQL forum!

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

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

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