tDBInput to query multiple table (wordpress user meta)

Highlighted
Four Stars

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,


Accepted Solutions
Employee

Re: tDBInput to query multiple table (wordpress user meta)

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


All Replies
Employee

Re: tDBInput to query multiple table (wordpress user meta)

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

Four Stars

Re: tDBInput to query multiple table (wordpress user meta)

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

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog