Monday, 15 September 2014

MySQL join question -


Can anyone tell me that if it is possible to add these two questions in one after joining yourself, and if yes , How to do it

Query 1:

  select pm.username as user, as file name, name, status, UC as ID Uc.content_id, value as moderation_status. The myweb.ugc_meta on parent_content_id um LEFT JOIN myweb.ugc_content UC uc.content_id = um.item_id where uc.user_id = pm.id pm Join left myweb.userbase_member uc.content_type = 'my.photo' and uc.promoted = '1' and moderation_status = '' boundary 10  

query 2:

  select um where um.item_id = value myweb.ugc_meta ' passed 4780c650137a3409901286 '- - (ITEM_ID query content_parent_id from 1)  

ugc_meta in ugc_content album for photos The name is included. Includes rows for ugc_content albums and photos > The photos representing rows have a parent_content_id , which for the original line is Content_id I do not have the option to change the table or DB structure.

At the moment I am running a new query (query2) for each result line from query 1 which is the optimal sub; -)

Thank you!

You should be able to use just add one without the Ugiaiamtia table

  select pm.username as user, id, value file name, name, status, UC as moderation_status as uc.content_id: in order to use a different alias your parents So like to get in the table to join Parent_content_id, the parent.`value` on myweb.ugc_meta Um left myweb.ugc_content uc uc.content_id = um.item_id left Join myweb.ugc_meta parent on uc.parent_content_id = parent.item_id left myweb.userbase_member pm on uc.user_id = pm.id uc.content_type = 'my.photo' and uc.promoted = '1' and moderation_status = boundary 10  

I'm looking for is a left as well as former 'pass' Where yoga can focus on the fact that parents can not always be in the child's table, if in this case there are always parents, then you can use the inner joiner. Which will increase your functionality further.


No comments:

Post a Comment