Populate select list with meta values from all posts of a Custom Post Type

Here is the solution I came up with, that works properly.

<form method="get" action="" onchange="submit();">
        <div class="input-group">
            <?php
            global $wpdb;
            $meta_key = 'item_oem';
            $data = $wpdb->get_results($wpdb->prepare( "SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key) , ARRAY_N  ); ?>
            <select class="custom-select" id="oems" aria-label="oems" name="item_oem" >
                <option selected>Search By OEM</option>
                <?php foreach( $data as $value ): ?>
                    <option value="<?php echo $value[0]; ?>"><?php echo $value[0]; ?> </option>
                <?php endforeach; ?>
          </select>
          <div class="input-group-append">
            <a href="/inventory" class="btn btn-secondary" type="button">Clear Filter</a>
          </div>
        </div>
    </form>