Hello
I have a database in which one of the attributes (column) has records (rows) with names A, B and C.
I need to count the frequency of these names in the database.
Does anyone have any idea how I do it?
thanks
Hello
I have a database in which one of the attributes (column) has records (rows) with names A, B and C.
I need to count the frequency of these names in the database.
Does anyone have any idea how I do it?
thanks
You could count the values via SQL:
Code:SELECT theColumn, COUNT(1) AS occurences FROM theTable WHERE theColumn IN ('A', 'B', 'C') GROUP BY theColumn ORDER BY theColumn
pdi-ce-4.3.0-stable
OpenJDK IcedTea 2.3.7 (7u21)
ubuntu 12.04 LTS (x86_64)
Is there only via SQL?
No, of course, but it usually is the most efficient way to group data, that come from a database.
You can achieve the same result with a combination of a Sort, Filter and GroupBy step.
pdi-ce-4.3.0-stable
OpenJDK IcedTea 2.3.7 (7u21)
ubuntu 12.04 LTS (x86_64)
I understand.
thanks
If you don't do the grouping by SQL on the database, you would have to get all the records first from your table before you do the actual grouping.
If your table is small it might not make a big difference, but on large tables this would decrease the performance of your transformation. (because for example getting a million rows first could take some time..)
Regards