Hello,
If I have a table have (id, amount) and id can be duplicate. How can I make a recordset having id,amount, amount percentage where amount percentage is group amount/ total amount. How can I make a recordset like this ?
Printable View
Hello,
If I have a table have (id, amount) and id can be duplicate. How can I make a recordset having id,amount, amount percentage where amount percentage is group amount/ total amount. How can I make a recordset like this ?
Grouped by WHAT ???
select id, sum(amount) , percentage(groupsum/total) from XXXX group by id
More of an SQL/database question. Moved to database section.
What type of RDMS are you using (Access, SQL Server, Oracle, etc)?
Potentially something like this, if the DBMS supports subqueries in the Select clause:
Code:select id, sum(amount) , (sum(amount) / (select sum(amount) from XXXX))*100 from XXXX group by id