Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tDBInput to query multiple table (wordpress user meta)

Hey guys,

I'm working with a Wordpress on MySQL. The user information are stored in 2 tables users and usermeta. I want to query the 2 tables to be able to output on a single row.

Here is the actual query:

 

SELECT `saje_users`.`ID`,
`saje_users`.`user_email`,
(select `saje_usermeta`.`meta_value` from `saje`.`saje_usermeta` where `saje_usermeta`.`user_id` = `saje_users`.`ID` and `saje_usermeta`.`meta_key` = 'first_name' limit 1) as firstname,
(select `saje_usermeta`.`meta_value` from `saje`.`saje_usermeta` where `saje_usermeta`.`user_id` = `saje_users`.`ID` and `saje_usermeta`.`meta_key` = 'last_name' limit 1) as lastname
FROM `saje`.`saje_users`;

 

How can I do this? Can I use the tDBInput? 

Thanks,

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

 

     You can use tDBInput component if you would like to join two tables in your query and use the result set in Talend for further processing. 

 

      In this case, you need to provide the schema details as the list of output columns in your query and you can provide the main table name in the Table name entry of tDBinput.

 

       Run the query once in MySQL Assistant to verify the output of the query and to fix any syntax errors and you can add the right query to the tDBInput Component Query area. Once you add all the details, connect a tlogrow to the output of tDBInput to print and see whether the data is coming correctly.

 

       If the answer has helped you, could you please mark the topic as resolved? Kudos are also welcome 🙂

 

Warm regards,

 

Nikhil

View solution in original post

2 Replies
Anonymous
Not applicable
Author

Hi,

 

     You can use tDBInput component if you would like to join two tables in your query and use the result set in Talend for further processing. 

 

      In this case, you need to provide the schema details as the list of output columns in your query and you can provide the main table name in the Table name entry of tDBinput.

 

       Run the query once in MySQL Assistant to verify the output of the query and to fix any syntax errors and you can add the right query to the tDBInput Component Query area. Once you add all the details, connect a tlogrow to the output of tDBInput to print and see whether the data is coming correctly.

 

       If the answer has helped you, could you please mark the topic as resolved? Kudos are also welcome 🙂

 

Warm regards,

 

Nikhil

Anonymous
Not applicable
Author

Thanks Nikhil,

 

I thought I absolutely needed to select a table in tDBInput, but as suggested, I've just created my query and schema and it worked. Thanks