Reputation: 281
In Oracle SQL how can a get a table replacing a column's value with the MAX?
I have:
ID Val
======= =======
1 10
2 19
3 55
4 40
And I want:
ID Val
======= =======
1 55
2 55
3 55
4 55
I tried:
SELECT id, MAX(Val)
FROM table;
But it's complaining about the GROUP BY
, if I add it for id
it will return the original table.
Upvotes: 0
Views: 1182
Reputation: 1270593
Use a window function:
SELECT id, MAX(Val) OVER ()
FROM table;
Upvotes: 3