I have a table like the following
Field1 Field2 Field3
------ ------- ------
x1 y1 z1
x1 y2 z2
x1 y3 z3
x1 y4 z4
x2 y1 z5
x2 y2 z6
x2 y3 z7
x2 y4 z8
x3 y1 z9
............and so on
I want to create a view with x1, x2, x3.. as unique
records; y1, y2, y3.... as fields; and z1, z2, z3.... as the values
When I do
CREATE VIEW xyz (y1, y2, y3, y4) AS
SELECT field1 ,
( SELECT field3 FROM table WHERE field2 = 'y1'),
( SELECT field3 .....
FROM table
I get the error that the sql query creates duplicate values. I think I
may have to do a join using distinct values of field1. I was looking
for some guidance with the join.
Thanks for your help in advance
(using SQLSERVER 2000)