SQL calculate percentage from values from two tables sql - Net-Raft.com

Welcome aboard! We are happy you are here and wish you good net-raft!




Just a Web Code Solution
join us

How to calculate the percentage from the values from two tables using sql ?


 83

SQL


0

TABLE NUMBERS1
ID POINTS 
1 5
1 10
2 30
2 5
2 6

TABLE NUMBERS2
ID POINTS 
2 5
1 10
2 30
2 5
1 6

MAX POINTS: 300


select ID, ROUND((SUM(POINTS) / 300) * 100) as number from (select ID, POINTS from NUMBERS1 UNION ALL select ID, POINTS from NUMBERS2) t group by ID order by number desc; 


By        
The power of the user (%)
8%



The most helpful SQL solutions

how to execute select into using sql ?how to execute select into using sql ?SQL

Click to see more ...

  623     53

convert string to date sqlconvert string to date sqlSQL

Click to see more ...

  532     42

How to get the last record from table using sql ?How to get the last record from table using sql ?SQL

Click to see more ...

  458     33

create table sqlcreate table sqlSQL

Click to see more ...

  230     23

How use like using sql ?How use like using sql ?SQL

Click to see more ...

  308     22

How to get the last 10 records using mysql ?How to get the last 10 records using mysql ?SQL

Click to see more ...

  202     21

rows to columns sqlrows to columns sqlSQL

Click to see more ...

  158     17

insert new column into table sqlinsert new column into table sqlSQL

Click to see more ...

  158     16

How to convert the values to lowercase using sql ?How to convert the values to lowercase using sql ?SQL

Click to see more ...

  168     13

How to change a negative number to positive using sql ?How to change a negative number to positive using sql ?SQL

Click to see more ...

  119     11

Welcome aboard!
We are happy you are here and
wish you good net-raft!