I have a table named Datatable. and it has a column named data.
data
-------
10
20
30
i need to get a column as
data
-------
10/60
20/60
30/60
i wrote the query as
select data/sum(data)
from datatable;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Using the window function
sumover the entire table (over ()):Example at SQL Fiddle.