I am trying to understand why I don't get a column when executing the following query. My goal is to make a simple sql query that will select a column and add the maximum value of the column to each row.
something like this
select rating + max(rating) from reviews;
this is incompatible with sql_mode=only full_group_by
select rating + 4 from reviews;
You can cross join the max rating (which is one row) to the original table and add it to the rating column.
select r.rating + m.maxrating from reviews r cross join (select max(rating) maxrating from reviews) m
or more simply
select rating + (select max(rating) from reviews) from reviews