Support

Account

Home Forums ACF PRO Empty Field Check in SQL Reply To: Empty Field Check in SQL

  • I’m not exactly sure what it is you’re trying to do really.

    You’re looking for posts that do not have any value set for “status” and a value in “sale_price” that is < 300000?

    If this is correct then:

    
    'meta_query' => array(
      'relation' => 'AND',
      array(
        'key' => 'sale_price',
        'value' => 300000,
        'type' => 'NUMERIC',
        'compare' => '<'
      ),
      array(
        'relation' => 'OR',
        array(
          'key' => 'status',
          'compare' => 'NOT EXISTS'
        ),
        array(
          'key' => 'status',
          'value' => '',
          'compare' => '='
        )
      )
    )