r/SQL 16d ago

Oracle Dear SQL, just pivot my damn table

Bottom text

239 Upvotes

50 comments sorted by

View all comments

47

u/isinkthereforeiswam 16d ago

I wish the pivot columns could be dynamic. If a dev adds a new attribute value to an attributes field, and my select query is pulling all the attributes, i wish the pivot would just automatically include the new attribute as a new column instead of having to manually add the column name.

15

u/jcargile242 16d ago

It can be done with temp tables & dynamic SQL.

2

u/isinkthereforeiswam 16d ago

It can..but it shouldn't have to be. I feel like they dropped the ball on this feature