I have TWO tables
1) column
2) row
COLUMN TABLE
COLumnID
----------------
1
2
3
4
5
6
7
8
9
ROW TABLE
ROW iD
-------------
100
104
101
99
77
20
10
The final output should look like this:
01.Row 1 2 3 4 5 6 7 8 9
02.----------- ---- ---- ---- ---- ---- ---- ---- ---- ----
03.10 x x x
04.20 x x x x
05.77 x x
06.99 x x x
07.100 x x x x
08.101 x
09.104 x x x x
The challenge is to mark a coordinate, with a value of X, if and only if the row value is divisible by the col value, i.e. it has a modulo of zero. The additional requirements are: the final query must work with random row values and the pivot operator should be used.
The following should do what you are looking for in sql server.
use a CTE to determine where the x should be and then pivot from that CTE