How to query all fields of the node that is tagged with taxonomy term from a specific vocabulary I'm struggling to find a way to retrieve all the node fields where a specific taxonomy is implemented. I was close to find something with this query :

$query = db_query('SELECT fci.field_name
    FROM d7_field_config_instance fci
    LEFT JOIN   (SELECT tv.vid, tv.machine_name
    FROM d7_taxonomy_vocabulary tv
    LEFT JOIN d7_taxonomy_term_data ttd
    ON tv.vid = ttd.vid
    WHERE ttd.tid = 76) AS tax
    ON tax.machine_name LIKE fci.bundle'));


But it seems like machine_name and bundle have different values for a same technology.

The idea is : From a taxonomy id => find taxonomy vid (vocabulary id) => find machine name of the vocabulary => find the bundles where this vocabulary is used.

Any help would be appreciated. 

Solution  : Thanks to @Eugis' answer (Accepted answer), I came up with this solution :

db_query("SELECT fcf.field_name, fcf.data FROM
          (SELECT fc.field_name, fc.data FROM field_config fc
          WHERE fc.type LIKE 'taxonomy_term_reference') AS fcf
        INNER JOIN field_config_instance fci
          ON fcf.field_name = fci.field_name
          AND fci.bundle LIKE :bundle",
      array(':bundle'=&gt; $bundle));


Hope it'll help someone else.
I think, you should check the field_config table where type = 'taxonomy_term_reference'.
The vocabulary name where the field is referencing to is stored in the data column as BLOB. you can use the unserialize php function to extract the data stored in the BLOB. That's because you can't reach it with a single select query. 

Try using loops and ifs :)