Row count based on a list of tables in Pentaho - pentaho

I am using an Input Table step to retrieve a list of owners and tables from Oracle's ALL_TABLES, then I want to pass to another step to, for each of this owner.table entries, it performs a SELECT COUNT(*) FROM owner.table.
The final result I want something like:
OWNER - TABLE - COUNT
How could I do that in Pentaho?
Thanks in advance!

Related

how to count rows of a table in pentaho etl, i didn't found the buttom that do the job

I want to know how to count a row of a table in Pentaho?
A method or button on Pentaho
I didn't find the bottom that does the job,
Thanks in advance
You can use a table input step in a transformation performing a query to output the row count, something like SELECT COUNT(*) AS numrows FROM table.
Or you have a Job Entry specific for this, it's named Evaluate rows number in a table.

How to run sql query and loop through a column then pass that column data into another query from a second database

I am fairly new to SQL. I am using SQL Server 2014. I want to run a query on a database which returns a column of ID's. I am wondering if it is possible to loop over the column of ID's from the first database and pass them into another database to collect additional info.
Attempted to Google the answer but I'm not able to find a helpful scenario that mimics what I am looking for.
SELECT *
FROM dbo.MYDB1
WHERE CreatedLoc = 123
The above example spits out data but I only care about the ID column
I than want to loop over the ID column and for each run them on another database.
SELECT *
FROM dbo.MYDB2
WHERE ID IN (array of ids here, not hardcoded but dynamic)
Assuming appropriate permissions, you can access a different database than the one you're currently connected to using a fully qualified databasename.schemaname.tablename (or view, etc.)
If your databases are MyDB1 and MyDB2, you can run a query that looks something like this:
SELECT * from MyDB2.dbo.Table2
where ID IN (
SELECT ID from MyDB1.dbo.Table1 where CreatedLoc = 123
)

Retrive unique records from an access table which does not have a fixed structure

I want only the unique records in same or new table. And I want to do this with different tables (having duplicate records) in access database through same code.
The flow should be like:
input table ------VBA MODULE------> table with unique records
I am able to do this group by function but for that i have to use field names in query. But field names will differ from table to table.
Please help!
Just use query
SELECT DISTINCT * FROM MyAnyTable

Using Excel range of cell values for ms query single paramter

I have an excel sheet with two fields: list of user id, and corresponding create date. I want to query from an external database having around million records by only returning records where user_id in (?). How can i pass a range of id's like $A1:A17 as the single parameter to the query?
One option to achieve the same result using another method would be to create a temporary table with just one column for user_id.
Then you could run the query and do:
where user_id in (select user_id from my_temp_table)

SQL - Get a count from a single table based on certain column criteria

I need to get a "simple" count of users that have >5 accounts tagged to the same UUID.
To do this for one single UUID, I perform the easy query:
Select count(user)
From Ply
Where Uuid Like 'i~cfe3a1eba3c2469aa3695e34c840fb62cb3e8791%'
(I added the % marker because we append extra tags to multiple accounts under the same UUID)
The result in the above query is a result of 5.
To take this to the next level, I want to count the number of users in the entire Ply table who have >5 accounts for 1 UUID.
Any suggestions would be much appreciated!
It sounds like you want
SELECT substr(uuid,1,42), count(user)
FROM ply
GROUP BY substr(uuid,1,42)
HAVING COUNT(*) > 5
If that is not what you want, it would be very helpful if you could post a table definition (DDL), some sample data (DML), and the output you want.