Reputation: 1489
Say that I have a table like that:
name | age
a | 1
b | 2
c | 3
d | 4
e | 5
f | 6
Normally, when we select MAX(age), it returns (f,6) tuple. But what I want is that it should return the table as it is, but all of the age values will be the maximum. Such as:
name | age
a | 6
b | 6
c | 6
d | 6
e | 6
f | 6
Is there a way to do this?
Upvotes: 2
Views: 2353
Reputation: 100587
Try this:
SELECT `name`,
(SELECT MAX(age) FROM MyTable) AS `age`
FROM MyTable;
Upvotes: 7