Hello All,
I am working on a query where I need to make 2 rows data as columns. I have 2 tables Table A and Table B from which I am getting the data.
Here is my Query.
SELECT DISTINCT A.Name, A.TableDescription, A.ColumnName, A.ColumnDescription, A.Spec_owner, A.DataOwnerType, B.CheckConstraint, B.CheckClause FROM tABLE A INNER JOIN Table1 B ON A.Name = B.TableName AND A.ColumnName = B.ColumnName
I will get the results like this when I execute the above query.
Name TableDescription ColumnName ColumnDesc Spec_Owner DataOwnerType
Line A Pipeline Component ID Unique Identifier Charles Custodial
Line A PipeLine Comp ID Unique Identifier David Standard
Line A Pipeline Comp ID Unique Identifier Ross Content
Line A Pipeline Comp Code Unique Code Susan Custodial
Line A Pipeline Comp Code Unique Code Ram Standard
Line A Pipeline Comp Code Unique Code Grace Content
Now I want the results to be displayed as
Name TableDescription ColumnName ColumnDesc Custodial Standard Content
Line A Pipeline Comp ID Unique Identifier Charles David Ross
Line A Pipeline Comp Code Unique Code Susan Ram Grace
As you can see from the results, the data in the columns DataOwnerType and Spec_Owner should become columns. I am not sure how we can do. Please help me in achieving this. Really appreciate any kind of suggestions.
Thank You