Hi,
I have a quastion:
I wrote a Query that count records in each column of my table, and give mi additional information on the percentage fill of each column.
Something like that:
Table:
ID |
column_A |
column_B |
column_C |
column_D |
1 |
23 |
4 |
340 |
460 |
2 |
430 |
540 |
4560 |
|
3 |
3540 |
453 |
30 |
40 |
4 |
|
4320 |
|
24320 |
5 |
|
6786 |
|
4320 |
6 |
|
786 |
|
432 |
7 |
|
|
|
320 |
8 |
|
2230 |
3420 |
3420 |
9 |
34530 |
5434530 |
2342 |
|
10 |
46540 |
546540 |
654650 |
5640 |
query:
Code:
SELECT Count(Tabela1.ID) AS table_size, Count(Tabela1.column_A) AS count_A, Count(Tabela1.column_A)/Count(Tabela1.ID) *100 AS A_percent, Count(Tabela1.column_B) AS count_B, Count(Tabela1.column_B)/Count(Tabela1.ID) *100 AS B_percent, Count(Tabela1.column_C) AS count_C, Count(Tabela1.column_C)/Count(Tabela1.ID) *100 AS C_percent
FROM Tabela1;
result:
table_size |
count_A |
A_percent |
count_B |
B_percent |
count_C |
C_percent |
10 |
5 |
50 |
9 |
90 |
6 |
60 |
Please advise me how to write a query, or use a different way to get a result in rows.
Something like that:
ID 10
columns_a 5, 50
columns_b 9, 90
columns_c 6, 60
Many thanx in advance