I posted this question earlier today and a couple of people responded but now the post no longer exists. I am not sure why it was deleted, so I am re-posting it.I have a table that returns the following rows:RBR Attribute Value------- ---------- ----------ONR XLOC MLONR XLOC MSONR XLOC MLONR XLOC MSONR CRE AAABC XLOC ARABC CRE BADDR XLOC MMI am having a difficult time trying to pivot the results to look like this:RBR XLOC CRE------- ------- ---------ONR ML AAONR MS AAABC AR BADDR MM NULLHere are the statements to create the table:[code="sql"]CREATE TABLE Test (RBR VARCHAR(3) NULL,Attribute VARCHAR(10) NULL,Value VARCHAR(2))INSERT INTO Test VALUES ('ONR','XLOC','ML')INSERT INTO Test VALUES ('ONR','XLOC','MS')INSERT INTO Test VALUES ('ONR','XLOC','ML')INSERT INTO Test VALUES ('ONR','XLOC','MS')INSERT INTO Test VALUES ('ONR','CRE','AA')INSERT INTO Test VALUES ('ABC','XLOC','AR')INSERT INTO Test VALUES ('ABC','CRE','BA')INSERT INTO Test VALUES ('DDR','XLOC','MM')[/code]
↧