Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
adbawany
Contributor
Contributor

Nested Mysql Query Email.

I am successfully able to fetch data from mysql using tmysqlrow and have it emailed after doing some data manipulation using tjavarow. 

 

Now I wish select all the categories and subcategories from the first table.

 

Then generate an email category wise. This is what I would want the three emails to look like.

 

0683p000009M82W.png

 

 

i can think of two approaches

 

Approach 1: I run a select query on each on the first table and fetch all the categories and subcategories and then for each of the subcategories, i go to the second table, select all the columns i need and then send out the email for each category. 

 

Approach 2: I use a join select statement, fetch everything and then email everything category wise, is this possible?

 

help please.

Labels (2)
1 Reply
Anonymous
Not applicable

Hi
Approach 1 is the best way, select all the categories from the first table, and then iterate each category for the next processing, the current category will be the parameter in other query.
eg:
tMysqlInput1--main(row1)--tFlowToIterate--iterate--tMysqlInput2--main-->babababa

on tMysqlInput, write the query as
"select item_name, time from tableName where category='"+(String)globalMap.get("row1.category")+"'"

//from this example, you can see that accessing the current category is to use the expression.
(String)globalMap.get("row1.category")

Hope it helps you.

Regards
Shong