How to write sql query to get the posts from a custom taxonomy term name

@Sisir linked you to the appropriate place, if you had read the question/answer and the linked Codex documentation you’d have seen that you could do something like the following:

$args = array(
    'post_type' => 'dealers'
    'tax_query' => array(
        array(
            'taxonomy' => 'state',
            'field' => 'slug',
            'terms' => array('bob','angela','john','smith','jan','doe','etc...')
        )
    )
);
$query = new WP_Query( $args );

Note the multiple state terms being queried, not the single specific one.