Vasanth Krishnan

Vasanth Krishnan

  • NA
  • 113
  • 54.8k

Select the row as a column in oracle 11g

May 30 2013 5:46 AM
Hi

I am having two table

           1. tbl_CategoryCreteria
           2.tbl_Feedback.

First table is used to save the creteria for the feedback and i am having the following values

tbl_CategoryCreteria.

        ID                 Name
        ---------------------
        1                  Lunch
        2                  Dinner

In the second table i having the value as

       ID  CreteriaID           Rating
  ----------------------------------
       1      1                    1
       2      1                    A
       3      2                    B
       4      2                    2

I need the output as following

              Lunch         Dinner
         ---------------------
              1                 B
              A                 2

(i.e) In the second table, i having the CreteriaID which is the FK of first table.

Instead of 1, i need to display as Lunch because the Creteria of 1 is Lunch in First table and i need to display as column.

Hope this is clear.

Please let me know if this is not.