I have a custom table in my Wordpress site that is created by a form plugin. I need to do a custom query to get the data from this custom table. There are several entries in the table with the same entry_id field as per the attached screenshot, one entry for every field completed on the form. What I need to do is to grab all the entries for a particular month and display the first and last name and telephone number on a table on a page. I am having problems creating the query that will pull this data from the table. I can easily get the entry_id where the value is the month I am looking for.
I can’t get my head around getting the other data I require without performing other multiple queries. I am sure that there must be a way to do this easily but I can’t work it out. Anyone help?
This is the code I have to pull the entry_id by month
$query ="
SELECT *
FROM wp_cf_form_entry_values
WHERE field_id = ‘fld_6840543’
AND VALUE = ‘October’
ORDER BY entry_id ASC";
$results = $wpdb->get_results($query,OBJECT);
This is the table structure screenshot with real identifiable data changed