Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Error in SQL query

$
0
0

Hi,

 

I am new to SQL. But i have logic with me.

 

How to assign select query to variable?

 

I am trying below code and its giving error.

 

 

What i want to achieve is i want to calculate SUM(SALARY) and COUNT(SALARY) and then divide the both.

 

something like that in lehman language.

 

:var1 = select sum(salary) from dummy;

:var2 = select count(salary) from dummy group by ID;

 

:var3 = :var1/:var2.

 

But i am facing syntax issues. can someone help?

 

declare var_sum int;

 

 

:var_sum = select sum("SALARY") as "Sum_Salary",

          from "Sumeet"."EMPLOYEE"

        group by "REGION";

 

 

SAP DBTech JDBC: [257]: sql syntax error: incorrect syntax near ":var_sum": line 1 col 1 (at pos 1)


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>