Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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,
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
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
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