I have type column in my table, type column value is HOT andNOT. from that i want to display HOT and NOT values of the column in to one line.
Example
Table1
Period ID Total
11/2011 101 250
12/2011 102 350
11/2011 103 450
....
Table2
Period ID Type Value
11/2011 101 NOT 500
11/2011 101 HOT 200
12/2011 102 NOT 300
12/2011 102 HOT 200
....
I want to display type (Hot and Not) in to one line
Expected Output
Period ID NOT HOT Total
11/2011 101 500 200 250
12/2011 102 300 200 350
11/2011 103 300 400 450
....
How to make a query.
If I can assume that table1 has a primary key of (Period, ID) and table2 has a primary key of (Period, ID, Type), then you can do:
This will retrieve all rows from table 1, with their corresponding “not” and “hot” counterparts, respective to t2n and t2h above.