jarvis Posted August 15, 2012 Share Posted August 15, 2012 Hi All, Apologies is this is the wrong forum, I wasn't sure if it should be Wordpress or MySQL! I hope someone can help! I've the following SQL which pulls info from Wordpress using the CIMY EXTRA Fields plugin. What I need to do is grab the last_name from the usermeta table too. However, I simply can't get it to work. Here's what I have: SELECT $wpdb->users.ID, display_name, cimy_sector.VALUE as sector, cimy_company.VALUE as company FROM $wpdb->users, {$wpdb->prefix}cimy_uef_data cimy_sector, {$wpdb->prefix}cimy_uef_fields cimy_fields1, {$wpdb->prefix}cimy_uef_data cimy_company, {$wpdb->prefix}cimy_uef_fields cimy_fields2 WHERE $wpdb->users.ID = cimy_sector.USER_ID AND $wpdb->users.ID = cimy_company.USER_ID AND cimy_sector.FIELD_ID = cimy_fields1.ID AND cimy_fields1.NAME ='SECTOR' AND cimy_sector.VALUE = '".$companyType."' AND cimy_company.FIELD_ID = cimy_fields2.ID AND cimy_fields2.NAME ='COMPANY' AND cimy_company.VALUE LIKE '%".$search_by."%'"; Now this works fine and retrieves the correct data. I simply can't get another table and the result I need, any help is much appreciated! TIA Quote Link to comment https://forums.phpfreaks.com/topic/267113-wordpress-sql-issue/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.