O
O
Onatsky2016-12-03 21:47:22
SQL
Onatsky, 2016-12-03 21:47:22

How to select records from table with percentage?

There is a table with certain amounts entered. How to make a selection of all records from the table so that the value of the sums of all records is 40%? Are there any built-in converters? DBMS access

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene Wolf, 2016-12-03
@Wolfnsex

I don’t quite understand your question, but if you need the selected values ​​to be 40% of the original instead, then the code (normal SQL, as far as it is applicable to Access, I can’t say) would look something like this:

SELECT (id * 0.4) AS percent from table1
-- или так:
SELECT *, (id * 0.4) AS percent from table1

Where ID is the field we need to get 40% of.

K
Konstantin Tsvetkov, 2016-12-04
@tsklab

Are there any built-in converters?
No. Having received the total amount with the SUM(sum) query, you will have to go through the records line by line until their sum reaches 40% of the total.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question