I’m new to sql and wanted to perform a simple task using aggregate function in sql.
select (current_data + avg(current_data)) as "average + current data" from datasets
However, arithmetic addition to aggregate function seems to not work in sql. What should I do to add current_data to the value of avg(current_data)?
Advertisement
Answer
Ty this-
SELECT current_data + ( SELECT avg(current_data) FROM datasets ) AS 'average + current data' FROM datasets