I have a query that I use for charting in reporting services that looks something like:
(SELECT Alpha, Beta, Gamma, Delta, Epsilon, Zeta, Eta, Theta, Iota, Kappa, Lambda, Mu,Nu, Xi from tbl WHERE Alpha in (@Alphas) and Beta in (@Betas) and Gamma in (@Gammas) and Delta in (@Deltas) and Epsilon in (@Epsilons) and Zeta in (@Zetas) and Eta in (@Etas) and Theta in (@Thetas) ) UNION (SELECT Alpha, Beta, Gamma, Delta, Epsilon, Zeta, Eta, Theta, Iota, Kappa, Lambda, Mu,Nu, Omicron from tbl WHERE Alpha in (@Alphas) and Beta in (@Betas) and Gamma in (@Gammas) and Delta in (@Deltas) and Epsilon in (@Epsilons) and Zeta in (@Zetas) and Eta in (@Etas) and Theta in (@Thetas))
Alpha through Theta are to be used to in a couple of calculated fields which concatenate them (say Alpha, Beta, Gamma) into a string in one field. The select statement for Omicron will generate the same number of rows as Xi but what I really want is to aggregate Omicron, so if the Select query with Xi produces 9 legend item, the aggregate select for Omicron should only produce one legend item because the values Alpha through Theta are not important for Omicron. How should the query be structured so I can use Alpha through Theta as parameters but still aggregate Omicron?