title: Check only specific information from the orders post meta data in Woocommerce
body: <p>I am currently working on a WordPress project that has the WooCommerce plugin on it for the store. However all the billing info from orders go to the wp_postmeta table, where the all of the info is saved in the same column, "meta_value".</p>
  
  <p>I have a form, that a customer can fill out using their order number, first name and post number, and after filing this field their order would show on the site.</p>
  
  <p>Hence in my query I would only like to check if the user inputted order number, first name and post number are true, and I don't need anything else from the column. </p>
  
  <p>I have made a test order with my credentials and at the moment my query looks like this, but it finds two results because there are two fields in the wp_postmeta table that have the same order number and the same first name in them as the order:</p>
  
  <pre><code>$ordernumber = $_POST['ordernmbr'];
  $orderfirstname = $_POST['firstname'];
  $orderpostnumber = $_POST['postnmbr'];
  
  $sql = $wpdb-&gt;prepare( "SELECT * FROM {$wpdb-&gt;prefix}postmeta
  WHERE post_id = %d AND meta_value = %s",
  $ordernumber, $orderfirstname);
  $res = $wpdb-&gt;get_results($sql, ARRAY_A);
  </code></pre>
  
  <p>Ask me if anything was unclear, I'm pretty bad at explaining things!</p>
  
  <p>EDIT: Updated query after getting help from Vel, still not working as intended as the query doesn't want to find any results.</p>
  
  <pre><code>$sql = $wpdb-&gt;prepare( "SELECT * FROM {$wpdb-&gt;prefix}postmeta
  WHERE post_id = %d AND (meta_value = %s AND meta_key  ='_billing_first_name' AND  meta_value = %s AND meta_key ='_billing_postcode') ",
  $ordernumber, $orderfirstname, $orderpostnumber );
  $res = $wpdb-&gt;get_results($sql, ARRAY_A);
  </code></pre>