sql - MySQL column manipulation nonsense -
for sake of example, have column of ints looks this:
column1 1 2 3 4 5
i have following code:
select column1+1 table
which returns you'd expect:
column1 2 3 4 5 6
on other hand if do:
select column1+avg(column1) table
i complete nonsense, single row. sincerely apologize if basic but, have no idea what's going on here. i've tried using cast on every possible combination of "colum1+avg(colum1)" still returns nonsense.
when have avg()
in select
, telling sql have aggregation query. without group by
, 1 row.
you intend this:
select column1 + (select avg(column1) table) table;
Comments
Post a Comment