I am new to coding and don't understand the Pivot function just wanted to know if someone can help me with below query.
I have a SQL Query below
select distinct hapf.position_code, pg.name
from
hr_all_positions_f hapf, PER_VALID_GRADES_F pvgf, per_grades pg
where
hapf.position_id = pvgf.position_id
and pvgf.grade_id = pg.grade_id
and hapf.position_code = 'ABCD'
This give an output as below
POSITION_CODE NAME
ABCD Grade03
ABCD Grade04
ABCD Grade05
But I want output as below
POSITION_CODE Grade1 Grade2 Grade3
ABCD Grade03 Grade04 Grade05
Can someone help me with the changes I need to make in my SQL query and what happens if I have another column whose value I want to Pivot ?
Thanks,
Shivam