Get users by custom field and field type I'm using Drupal 7. 
I'm trying to get all users with custom field field_id:

$users = user_load_multiple(array(), array('field_id' =&gt; '123456789'));
var_dump($users);


and I got the following error:

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'base.field_id' in 'where clause': SELECT base.uid AS uid, base.name AS name, base.pass AS pass, base.mail AS mail, base.theme AS theme, base.signature AS signature, base.signature_format AS signature_format, base.created AS created, base.access AS access, base.login AS login, base.status AS status, base.timezone AS timezone, base.language AS language, base.picture AS picture, base.init AS init, base.data AS data FROM {users} base WHERE (base.field_id = :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => 123456789 ) in DrupalDefaultEntityController->load() (line 191 of C:\wamp\www\my_proj\includes\entity.inc).

My questions:
1. How can get users by custom field ? 
2. How to query the field type ? (is it text, int, float, etc..).
You'll need an EntityFieldQuery for that:

$query = new EntityFieldQuery();
$query-&gt;entityCondition('entity_type', 'user')
  -&gt;fieldCondition('field_id', 'value', $field_id);


There's no native way to query by type of field. To do that you'll need to use the EntityFieldQuery::addTag() method to add a custom tag to the query, and then use hook_query_TAG_alter() to manually join the field_config table into the query before it's run.