Skip to Content
0
Former Member
Nov 12, 2015 at 04:07 PM

Populating a column with the result of a query from the same table

66 Views

Hello good people,

I want to populate a column("APR_REV") in my table by using an SQL query on the same table. The query is:

select "REVENUE" FROM "MySCHEMA".MYTABLE"

WHERE "Month" = 'APRIL' group by "ID", "REVENUE" ;

Note that Month stores strings

I tried many different queries with the below one showing most promise as it showed rows effected in the result but nothing is printed in the column.

insert into "D063375"."MySCHEMA".MYTABLE"("APR_REV")

select "REVENUE" FROM "MySCHEMA".MYTABLE"

WHERE "Month" = 'APRIL' group by "ID", "REVENUE" ;

My question is, is it possible to do that? if yes any guidance on the how would be much appreciated as I'm a bit of a novice with HANA and SQL.