1

Topic: The request to help with request

Tables and request on sqlfiddle http://sqlfiddle.com/#!6/f952bf/1
There why that does not work absolutely for me produces

ColorCode StyleSize Ratio
BLACK 18/24 2
BLACK 30/36 2
BLACK 4y 1
BLACK 5y 1
BLACK 6y 1
CAMMEL 18/24 2
CAMMEL 30/36 2
CAMMEL 4y 2
CAMMEL 5y 2
CAMMEL 6y 2
NAVY 18/24 2
NAVY 30/36 2
NAVY 4y 1
NAVY 5y 1
NAVY 6y 1
SALUTE 18/24 2
SALUTE 30/36 2
SALUTE 4y 1
SALUTE 5y 1
SALUTE 6y 1

I need to show it here how at width that would be as Excell

colors/size 0/3 3/6 6/12 12/18 18/24 30/36 4y 5y 6y 8y 10y 12y 14y 16y 18y 20y Total
BLACK 2 2 2 2 2
CAMMEL 2 1 2
NAVY 2 2 1

2

Re: The request to help with request

that would be as Excell

3

Re: The request to help with request

The grandfather;
Thanks, are similar to that that is necessary, can know as it to use without an aggregate function
Here that at me it turned out

SELECT ColorCode as ' colors/size ', [5], [6], [7], [8], [9]
FROM
(SELECT StyleColors. ColorCode as ColorCode, StyleSizes. StyleSizeID as StyleSizeID, OrderStyleColorSize. Ratio as Ratio
FROM OrderStyleColorSize INNER JOIN
StyleColors ON OrderStyleColorSize. ColorID = StyleColors. ColorID INNER JOIN
StyleSizes ON OrderStyleColorSize. StyleSizeID = StyleSizes. StyleSizeID) p
PIVOT
(
COUNT (Ratio)
FOR StyleSizeID IN
([5], [6], [7], [8], [9])
) AS pvt
ORDER BY pvt. ColorCode;

As though to me instead of COUNT (Ratio) to use value from Ratio?

4

Re: The request to help with request

Earned as it is necessary with SUM