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.
Use a window function:
SELECT id, MAX(Val) OVER ()
FROM table;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.